koha.git
2 years agoBug 30536: Fix Query.t Unit Test
Martin Renvoize [Tue, 3 May 2022 07:06:41 +0000 (08:06 +0100)]
Bug 30536: Fix Query.t Unit Test

The stash_embed method no longer validates the query so this patch drops
the validation tests and instead just focuses on varifying the correct
output structure of the stash after the method call.

We have not lost validation however, it now happens only once at the
OpenAPI level and tests are present in t/db_dependent/api/v1/query.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30536: (QA follow-up) POD + Spec Consistency
Martin Renvoize [Fri, 29 Apr 2022 15:43:36 +0000 (16:43 +0100)]
Bug 30536: (QA follow-up) POD + Spec Consistency

Well spotted, this patch fixes the specs to be consistent and adds a
little detail to the POD as requested.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30536: Update spec files
Martin Renvoize [Thu, 14 Apr 2022 15:06:24 +0000 (16:06 +0100)]
Bug 30536: Update spec files

This patch removes superflous x-koha-embed defintions at the top level
of the endpoint specifications. It also replaces a few x-koha-embeds at
the top level with parameter lists where this had been missed in
preceeding patches.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30536: Remove validation overhead
Martin Renvoize [Thu, 14 Apr 2022 12:47:06 +0000 (13:47 +0100)]
Bug 30536: Remove validation overhead

With the introduction of proper validation of collection headers in
OpenAPI we no longer need to do our own validation here.

This patch removes the early validation of x-koha-embed headers in
preference to letting OpenAPI do it once and only once instead.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30536: Refer to parameters enum
Martin Renvoize [Thu, 14 Apr 2022 11:22:27 +0000 (12:22 +0100)]
Bug 30536: Refer to parameters enum

This patch updates the stash_embed method to use the parameters hash
enum instead of the top level x-koha-embed custom definition. This way
we can remove the requirement for defining this list twice.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30536: Unit tests
Tomas Cohen Arazi [Thu, 14 Apr 2022 15:07:49 +0000 (12:07 -0300)]
Bug 30536: Unit tests

This patch adds tests to make sure there's no behavior change regarding
error conditions. When requests include wrong x-koha-embed values, a 400
error should be returned, both in our original implementation or relying
on the Mojolicious::Plugin::OpenAPI features.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> SUCCESS: Tests pass
3. Apply the rest of the patches
4. Repeat 2
=> SUCCESS: Tests still pass
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30632: Fix report author display in list of saved reports
Owen Leonard [Thu, 28 Apr 2022 15:17:35 +0000 (15:17 +0000)]
Bug 30632: Fix report author display in list of saved reports

This patch removes whitespace in the template around the markup of
report author first name and surname. This prevents unwanted spaces in
the output.

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

The display of report author should be like this:

Leonard, Owen (123456)

Instead of Leonard , Owen (20375)

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>
2 years agoBug 10517: (QA follow-up) No need to remove second true
Marcel de Rooy [Fri, 29 Apr 2022 09:18:24 +0000 (09:18 +0000)]
Bug 10517: (QA follow-up) No need to remove second true

This is just theoretical, but by removing the second true you
could end the script on another error.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 10517: Use `DROP USER IF EXISTS` and remove ` || true`.
Rudolf Byker [Wed, 8 Jan 2020 09:20:02 +0000 (11:20 +0200)]
Bug 10517: Use `DROP USER IF EXISTS` and remove ` || true`.

When restoring a Koha instance, and the database user does not exist, an error is shown,
although it is prevented from stopping the script by ` || true`. This patch removes the
` || true` guard, and rather uses `DROP USER IF EXISTS` which does exactly what one
would expect, without confusing error messages, whether the user existed or not.

To test:
1) Assume your Koha instance is called `asdf`.
1) Export the Koha instance using `koha-dump`.
2) Remove the instance completely using `koha-remove`.
3) Import it again using `koha-restore`.
4) No error should be shown, and the import should work. There was NO user to drop, therefore `DROP USER IF EXISTS` did nothing.
5) A database user called `koha_asdf` should exist, and have all privileges on the database of the same name.
6) Remove the instance again using `koha-remove`.
7) Now create a database user in MySQL called `koha_instance` where instance is the name of your dumped koha instance.
8) Import your koha instance again using `koha-restore`.
9) Again, no error should be shown, and the import should work. There WAS a user to drop, therefore `DROP USER IF EXISTS` dropped the user before creating a new one.
10) Again, a database user called `koha_asdf` should exist, and have all privileges on the database of the same name.

Sponsored-by: Reformational Study Centre
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30143: OAI-PMH: Fix SQL query used to fetch deleted records
Ere Maijala [Mon, 21 Feb 2022 14:07:00 +0000 (16:07 +0200)]
Bug 30143: OAI-PMH: Fix SQL query used to fetch deleted records

The query was missing the "ORDER BY" and "LIMIT" clauses, which could make retrieve a wrong set of records.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29537: Remove unnecessary if-else checks for soonest renew date
Nick Clemens [Thu, 24 Mar 2022 11:42:55 +0000 (11:42 +0000)]
Bug 29537: Remove unnecessary if-else checks for soonest renew date

GetSoonestRenewDate() calculates the renewal due date now also
correctly for auto-renewals after the fixes from bug 29476 so we don't
have to add any if-else checks because of it being buggy anymore.

To test:
 1) prove t/db_dependent/Circulation.t

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>
2 years agoBug 22785: DBRev 21.12.00.046
Fridolin Somers [Tue, 3 May 2022 20:38:04 +0000 (10:38 -1000)]
Bug 22785: DBRev 21.12.00.046

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22785: Update DBIC schema
Fridolin Somers [Tue, 3 May 2022 20:37:04 +0000 (10:37 -1000)]
Bug 22785: Update DBIC schema

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22785: (follow-up) Update contentType in request
Nick Clemens [Thu, 28 Apr 2022 10:28:58 +0000 (10:28 +0000)]
Bug 22785: (follow-up) Update contentType in request

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22785: (QA follow-up) Remove superflous spec files
Martin Renvoize [Wed, 27 Apr 2022 16:31:03 +0000 (17:31 +0100)]
Bug 22785: (QA follow-up) Remove superflous spec files

We don't need these any more.. I think they crept back in during
rebases

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22785: (follow-up) Fix translatability
Nick Clemens [Mon, 20 Dec 2021 14:54:59 +0000 (14:54 +0000)]
Bug 22785: (follow-up) Fix translatability

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22785: (follow-up) Don't sort by chosen and fix selection of matches
Nick Clemens [Wed, 19 May 2021 10:54:49 +0000 (10:54 +0000)]
Bug 22785: (follow-up) Don't sort by chosen and fix selection of matches

Previously the sorting took 'chosen' into account and would move a selected match to the
top on next load - it is better to preserve the same sorting every time

When loading matches the 'cehcked' variable was not being cleared, so multiple matches were
being marked 'checked="checked"'. Fixing this ensures the correct record displays as chosen

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Ben Daeuber <bdaeuber@cityoffargo.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22785: Update Schema for boolean
Nick Clemens [Mon, 4 Jan 2021 14:23:52 +0000 (14:23 +0000)]
Bug 22785: Update Schema for boolean

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Ben Daeuber <bdaeuber@cityoffargo.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22785: Allow option to choose which record match is applied during import
Nick Clemens [Mon, 31 Aug 2020 17:01:24 +0000 (17:01 +0000)]
Bug 22785: Allow option to choose which record match is applied during import

This patchset adds the display of all matches found during import to the import management screen

A staff member with the permission to manage batches will be able to select for any individual record which match, or none, should be used during import

To test:
1 - Import a batch of records or export existing records from your catalog
2 - Import the file (again) and select a matching rule that will find matches
3 - Note that you now have radio buttons allowing you to select a record, or none
4 - Test scenarios:
    I - When 'Action if matching record found' is 'Ignore'
        a - Imported record ignored if match is selected
        b - 'Action if no match found' followed if no match is selected (Ignore matches)
    II - When 'Action if matching record found' is 'Replace'
        a - The chosen record is the one overlayed (you can edit the chosen record before importing to confirm)
        b - 'Action if no match found' followed if no match is selected (Ignore matches)
    III - When 'Action if matching record found' is 'Add incoming record'
        a - Record is added regardless of matches
5 - Confirm 'Diff' 'View' links work as expected
6 - Confirm that after records are imported the radio buttons to choose are disabled

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Bug 22785: API files

Signed-off-by: Ben Daeuber <bdaeuber@cityoffargo.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30466: Compiled CSS
Fridolin Somers [Tue, 3 May 2022 20:17:52 +0000 (10:17 -1000)]
Bug 30466: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30436: Convert article requests tabs to Bootstrap
Owen Leonard [Fri, 1 Apr 2022 15:50:32 +0000 (15:50 +0000)]
Bug 30436: Convert article requests tabs to Bootstrap

This patch converts the jQuery tabs on the article requests page to
Bootstrap.

To test you should have the "ArticleRequests" system preference
enabled. If necessary, create some article requests and mark some
"Pending," some "Processing," and leave some new.

- Apply the patch and go to Circulation -> Article requests.
- The page should show three tabs: New, Pending, and Processing.
- The tabs should look correct and work correctly.
- The DataTables under each tab should work correctly.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30466: Convert serials pages tabs to Bootstrap
Owen Leonard [Wed, 20 Apr 2022 12:53:27 +0000 (12:53 +0000)]
Bug 30466: Convert serials pages tabs to Bootstrap

This patch modifies three serials templates in order to replace jQueryUI
tabs with Bootstrap tabs.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Go to Serials.
- Perform a serials search which will return one or more results.
- On the search results page you should see an Open and Closed tab.
- The tabs should look correct and work correctly.
- Confirm that "Select all" and "Clear all" controls work correctly in
  each tab.

- Click one of the search results to view the details for that
  subscription.
- You should see tabs for Information, Planning, Issues, and Summary.
  You may also see an Acquisition details tab depending on your data.

- In the sidebar menu click "Serial collection."
- On this page you should see tabs corresponding to each year the serial
  has been received.
- Under each tab the "Select all" and "Clear all" controls should work
  correctly in the context of that tab. Other controls should apply to
  all tabs.

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>
2 years agoBug 14242: DBRev 21.12.00.045
Fridolin Somers [Tue, 3 May 2022 20:10:39 +0000 (10:10 -1000)]
Bug 14242: DBRev 21.12.00.045

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 14242: (QA follow-up) Update hint on suggestion form: 2016 > 2022
Katrin Fischer [Thu, 28 Apr 2022 14:45:21 +0000 (14:45 +0000)]
Bug 14242: (QA follow-up) Update hint on suggestion form: 2016 > 2022

First patches were written in 2015 - so I think we can safely
move the hint closer to the present.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 14242: (QA follow-up) Fix alphatic order of sysprefs.sql
Katrin Fischer [Thu, 28 Apr 2022 14:37:01 +0000 (14:37 +0000)]
Bug 14242: (QA follow-up) Fix alphatic order of sysprefs.sql

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 14242: (follow-up) Clear all text input fields
Aleisha Amohia [Wed, 2 Mar 2022 02:21:01 +0000 (15:21 +1300)]
Bug 14242: (follow-up) Clear all text input fields

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN
Aleisha Amohia [Tue, 28 Sep 2021 02:24:48 +0000 (15:24 +1300)]
Bug 14242: (follow-up) Hide autofil when syspref disabled, clear ISBN

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 14242: (follow-up) Format copyright date before plugged into form
Aleisha Amohia [Thu, 18 Feb 2021 00:50:38 +0000 (13:50 +1300)]
Bug 14242: (follow-up) Format copyright date before plugged into form

This patch formats the copyright date so that only the year shows before
plugging the formatted version into the form.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 14242: Use ISBN-field to automatically fill out purchase suggestions
Martin Stenberg [Wed, 26 Aug 2015 18:22:30 +0000 (20:22 +0200)]
Bug 14242: Use ISBN-field to automatically fill out purchase suggestions

Add new jQuery plugin "autofill" which transforms selected element(s)
into search fields for Google Books API and automatically fills
requested fields with search result.

Use in OPAC purchase suggestions to automatically fill out fields when
entering ISBN-number.

Test plan:
1. Run updatedatabase.pl
2. Enable system precference "OPACSuggestionAutoFill"
3. Log into OPAC and go to purchase suggestions page
4. Write a valid ISBN (such as 0-9690745-2-2 or 978-1-78416-110-1) into
   the ISBN field and click the 'search google books' button, or unfocus
   the field.
5. Title, Author, Publisher, publication year and Item Type fields should now be filled
   automatically.
6. Press "clear form" to undo - should restore all fields that the API pull
   filled to empty

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30550: (QA follow-up) Clear cleartext remainders
Marcel de Rooy [Tue, 3 May 2022 12:25:50 +0000 (12:25 +0000)]
Bug 30550: (QA follow-up) Clear cleartext remainders

Clear enough?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30550: OPAC recalls page tries to use jQueryUI datepicker
Owen Leonard [Thu, 14 Apr 2022 18:27:47 +0000 (18:27 +0000)]
Bug 30550: OPAC recalls page tries to use jQueryUI datepicker

This patch updates the recalls page in the OPAC so that it uses
Flatpickr for the "Recall not needed after" field.

To test apply the patch and enable the UseRecalls preference if
necessary. You made need to update your circulation rules as well,
defining some default values for recalls.

- Log in to the OPAC.
- Locate a bibliographic record which has one item and that item is
  checked out.
- Click "Place recall."
- The "Recall not needed after" field should be styled correctly, and
  clicking it should trigger the calendar popup.
- You should be limited to selections after today's date.

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>
2 years agoBug 27344: Add error detail if something wrong happened
Jonathan Druart [Wed, 6 Apr 2022 14:11:29 +0000 (16:11 +0200)]
Bug 27344: Add error detail if something wrong happened

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27344: Fix call to update_index with invalid ids
Jonathan Druart [Wed, 6 Apr 2022 12:38:04 +0000 (14:38 +0200)]
Bug 27344: Fix call to update_index with invalid ids

Can't use an undefined value as an ARRAY reference at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch/Indexer.pm line 121.

Caught that when working on follow-up bug reports.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27344: Fix tests
Jonathan Druart [Wed, 6 Apr 2022 12:33:05 +0000 (14:33 +0200)]
Bug 27344: Fix tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27344: Warn the error in the log
Jonathan Druart [Tue, 5 Apr 2022 12:52:17 +0000 (14:52 +0200)]
Bug 27344: Warn the error in the log

Otherwise info about the failure is hidden in DB

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27344: Add missing imports
Jonathan Druart [Tue, 5 Apr 2022 12:51:09 +0000 (14:51 +0200)]
Bug 27344: Add missing imports

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27344: Adapt to bug 30181 changes
Tomas Cohen Arazi [Fri, 1 Apr 2022 10:25:56 +0000 (12:25 +0200)]
Bug 27344: Adapt to bug 30181 changes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27344: Add missing include file
Jonathan Druart [Wed, 30 Mar 2022 13:20:20 +0000 (15:20 +0200)]
Bug 27344: Add missing include file

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27344: Implement Elastic's update_index_background using Koha::BackgroundJob
Jonathan Druart [Tue, 5 Jan 2021 13:42:20 +0000 (14:42 +0100)]
Bug 27344: Implement Elastic's update_index_background using Koha::BackgroundJob

This patch adds a background job submodule, UpdateElasticIndex, to deal
with async ES index update (not the deletion).

Using NYTProf (on a checkin):
Without
618ms, executing 35676 statements and 26355 subroutine calls in 266 source files and 83 string evals.

With
521ms, executing 13282 statements and 7979 subroutine calls in 195 source files and 26 string evals.

However there are some problems with this patch:
1. We don't want *all* the index update to be in the background_jobs
tabtle (we could add a filter on the list view)
2. We don't track the "progress" of the job as we are sending all the
records to Elastic. It is okish in my opinion but it must be noted.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27750: Remove jquery.cookie.js plugin
Owen Leonard [Wed, 2 Feb 2022 15:15:58 +0000 (15:15 +0000)]
Bug 27750: Remove jquery.cookie.js plugin

This patch removes references to the jquery.cookie.js plugin which is
now unused, replaced by js-cookie.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29894: DBRev 21.12.00.044
Fridolin Somers [Mon, 2 May 2022 21:11:52 +0000 (11:11 -1000)]
Bug 29894: DBRev 21.12.00.044

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29894: Add Selenium tests for disable 2FA
Jonathan Druart [Fri, 22 Apr 2022 10:24:17 +0000 (12:24 +0200)]
Bug 29894: Add Selenium tests for disable 2FA

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29894: (QA follow-up) Get rid of send_confirm_notice
Marcel de Rooy [Fri, 22 Apr 2022 06:39:32 +0000 (06:39 +0000)]
Bug 29894: (QA follow-up) Get rid of send_confirm_notice

Chose here to fall back to $patron->queue_notice. Which is tested
already, so removing the additional test code.

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>
2 years agoBug 29894: (follow-up) Update notice terms
Martin Renvoize [Thu, 21 Apr 2022 13:53:18 +0000 (14:53 +0100)]
Bug 29894: (follow-up) Update notice terms

Register and Derigister didn't sound right, in reality we we enabling
and disabling 2FA for the user so I think those terms are more
understandable.

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>
2 years agoBug 29894: Send a confirmation notice
Marcel de Rooy [Fri, 21 Jan 2022 07:58:45 +0000 (07:58 +0000)]
Bug 29894: Send a confirmation notice

When registering or deregistering, send a confirmation.

Test plan:
Register or deregister with patron having email address.
Verify that you got a confirmation mail.
Run t/db_dependent/Koha/Auth/TwoFactorAuth.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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29894: Db rev for adding notices
Marcel de Rooy [Fri, 21 Jan 2022 08:42:08 +0000 (08:42 +0000)]
Bug 29894: Db rev for adding notices

This dbrev adds two notices:
2FA_REGISTER and 2FA_DEREGISTER

Test plan:
Run the dbrev.
Check if you see them on Tools/Notices.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
2 years agoBug 29894: Clear secret when disabling 2FA
Marcel de Rooy [Thu, 20 Jan 2022 15:07:30 +0000 (15:07 +0000)]
Bug 29894: Clear secret when disabling 2FA

Test plan:
Deregister 2FA for patron.
Check if secret is empty in borrowers.secret.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
2 years agoBug 29894: Add some exceptions to TwoFactorAuth module
Marcel de Rooy [Thu, 20 Jan 2022 14:43:42 +0000 (14:43 +0000)]
Bug 29894: Add some exceptions to TwoFactorAuth module

Test updated accordingly.
Adding utf8 flag to CGI in staff script.

Test plan:
Run t/db_dependent/Koha/Auth/TwoFactorAuth.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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29873: Add unit test
Marcel de Rooy [Thu, 13 Jan 2022 15:33:42 +0000 (15:33 +0000)]
Bug 29873: Add unit test

Test plan:
Run t/db_dependent/Koha/Auth/TwoFactorAuth.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended to reflect requested changes.
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>
2 years agoBug 29873: Create QR code
Marcel de Rooy [Thu, 13 Jan 2022 14:27:36 +0000 (14:27 +0000)]
Bug 29873: Create QR code

Instead of using deprecated Google Charts API, and exposing our
secret in a GET parameter, we generate QR data ourselves.

Test plan:
[1] Enable two factor authentication in the prefs.
[2] Login in staff. Go to account. Select Manage 2FA.
[3] Verify that QR code is displayed.
[4] Register the QR in your authenticator app and test 2FA
    by logging in again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with Google Authenticator and FreeOTP.

Bug 29873: (follow-up) Rename qr_dataurl

As requested by a QA team member.
We're moving to qr_code as method name. This is the same name as
the method in the underlying base class.
Apart from one sed statement, changing to self->SUPER on one line.

Test plan:
Can you still register, logout and login?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 29873: (follow-up) Switch to GD

We do not need a new module, we could use GD instead.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
2 years agoBug 30108: (follow-up) Make require label translatable
Fridolin Somers [Mon, 2 May 2022 21:03:00 +0000 (11:03 -1000)]
Bug 30108: (follow-up) Make require label translatable

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30108: DBRev 21.12.00.043
Fridolin Somers [Mon, 2 May 2022 20:50:35 +0000 (10:50 -1000)]
Bug 30108: DBRev 21.12.00.043

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30108: (follow-up) Add required indication, differentiate alert
Marcel de Rooy [Fri, 4 Mar 2022 10:47:19 +0000 (10:47 +0000)]
Bug 30108: (follow-up) Add required indication, differentiate alert

As asked on comment4:
[1] Add a required div as a visible hint when applicable.
[2] Differentiate alert for hold start and end date.

Test plan:
See former patch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30108: Allow making hold dates required
Marcel de Rooy [Tue, 15 Feb 2022 15:25:59 +0000 (16:25 +0100)]
Bug 30108: Allow making hold dates required

Side note: Template still referred to class holddateto while not
being used any longer. Replaced this occurrence by futuredate.

Test plan:
[1] Disable OPACAllowHoldDateInFuture.
[2] Set pref OPACMandatoryHoldDates to "end date".
[3] Verify that the end date is mandatory on opac-reserve.
[4] Set pref OPACMandatoryHoldDates to "start date".
[5] Verify that no dates are required.
[6] Enable OPACAllowHoldDateInFuture.
[7] Verify that start dates are required.
[8] Set pref OPACMandatoryHoldDates to "no dates".
[9] Verify that no dates are required again.

Bonus:
Check that more options box is opened when a date still is required.
In case of item level being forced, verify that more options is opened
regardless of pref setting.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30108: Preference description
Marcel de Rooy [Thu, 17 Feb 2022 13:22:35 +0000 (13:22 +0000)]
Bug 30108: Preference description

Test plan:
Check the preferences form, tab Circulation, tab Hold policy.
Look for OPACMandatoryHoldDates.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30108: Database revision, adding new preference
Marcel de Rooy [Thu, 17 Feb 2022 12:55:20 +0000 (12:55 +0000)]
Bug 30108: Database revision, adding new preference

Test plan:
Run upgrade or new install.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30433: Convert advanced search tabs to Bootstrap
Owen Leonard [Fri, 1 Apr 2022 13:10:49 +0000 (13:10 +0000)]
Bug 30433: Convert advanced search tabs to Bootstrap

This patch updates the advanced search page in the staff interface to
use Bootstrap tabs instead of jQueryUI.

To test, apply the patch and test the advanced search interface. The
tabs should look correct and work correctly.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30424: (follow-up) Markup comments
Owen Leonard [Thu, 31 Mar 2022 18:46:16 +0000 (18:46 +0000)]
Bug 30424: (follow-up) Markup comments

This patch adds comments to the template to highlight the markup
structure.

This patch should have no effect on the page's appearance or
functionality.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30424: Reindent advanced search template in the staff interface
Owen Leonard [Thu, 31 Mar 2022 18:23:53 +0000 (18:23 +0000)]
Bug 30424: Reindent advanced search template in the staff interface

This patch reindents the advanced search template. Some lines have been
split to make the markup more readable.

To test, apply the patch and test the advanced search page in the staff
interface. Everything should work as normal. Be sure to test both the
"More options" and "Fewer options" views.

When viewing the diff for this change, ignore whitespace. The only
visible changes should be split lines.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30545: Replace the use of jQueryUI Accordion on the notices page
Owen Leonard [Fri, 8 Apr 2022 12:20:00 +0000 (12:20 +0000)]
Bug 30545: Replace the use of jQueryUI Accordion on the notices page

This patch updates the notices edit interface in order to replace
jQueryUI accordion and tabs widgets with Bootstrap collapse and tabs.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Set the TranslateNotices system preference to "Don't allow."
- Go to Tools -> Notices and edit any notice.
- On the "Modify notice" page you should see three collapsed sections:
  Email, Print, and SMS.
- Clicking the section headings should expand and collapse the panels.
- With one of the panels open, click Save -> Save and continue editing.
  - When the page reloads the same panel should be expanded.

- Enable the TranslateNotices system preference.
- Return to the edit interface for one of your notices.
- You should now see at least two tabs: Default and English.
- The sections under each tab should continue to work correctly.
- Test the "Save and continue" functionality again. When redirected you
  should return to both the correct tab and the correct panel, e.g. the
  "Print" section under the "English (en)" tab.

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>
2 years agoBug 30494: Compiled CSS
Fridolin Somers [Mon, 2 May 2022 20:34:01 +0000 (10:34 -1000)]
Bug 30494: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30494: Replace the use of jQueryUI Accordion on the table settings page
Owen Leonard [Thu, 7 Apr 2022 16:02:37 +0000 (16:02 +0000)]
Bug 30494: Replace the use of jQueryUI Accordion on the table settings page

This page updates the table settings page so that it uses Bootstrap's
"Collapse" feature instead of jQueryUI's Accordion.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Go to Administration -> Table settings.
- You should see a list of table settings which looks much the same as
  it did before, with arrow icons prefixing each section header. All
  panels should be collapsed.
- Test expanding and collapsing panels to confirm it's working
  correctly.
- When you expand a section the heading arrow should change from
  right-pointing to down.
- Make a change to one of the table configurations. After clicking
  "Save" the page should reload with the same panel expanded.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30491: Convert saved reports tabs to Bootstrap
Owen Leonard [Thu, 7 Apr 2022 14:39:55 +0000 (14:39 +0000)]
Bug 30491: Convert saved reports tabs to Bootstrap

This patch updates the saved reports page so that it uses Bootstrap tabs
instead of jQueryUI.

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

 - On the Saved Reports page you should see multiple tabs.
 - Each should look correct and work correctly.
 - Clicking each tab should result in the table of reports filtering
   correctly for that tab (Patrons tab showing only patrons reports).
 - If necessary, edit one or more reports so that they have a subgroup.
 - Confirm that each subgroup selector is correct for each tab, i.e. a
   subgroup created under "Catalog" should only be available under the
   Catalog tab.

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>
2 years agoBug 30489: Convert MARC and authority subfield edit tabs to Bootstrap
Owen Leonard [Mon, 11 Apr 2022 12:00:38 +0000 (12:00 +0000)]
Bug 30489: Convert MARC and authority subfield edit tabs to Bootstrap

This patch updates the MARC and authority subfield edit interface to
replace jQueryUI tabs with Bootstrap. The code for handling
drag-to-reorder tabs is updated to accommodate the new markup.

To test, apply the patch and restart_all.

- Go to Administration -> MARC bibliographic framework -> Default
  framework and choose "MARC structure" from the Actions menu.
- In the row for 000 LEADER, click Actions -> View subfields.
- Click "Edit." On the edit page the tabs should look correct and work
  correctly.
- Return to the list of tags and click "View subfields" for the 245 tag.
- Click one of the "Edit" buttons for any but the first subfield, e.g.
  "a".
- On the "Tag 245 Subfield constraints" page the "a" tab should be
  pre-selected.
- Click any of the subfield tabs and drag it to re-order it in the
  sequence of tags.
- It should stay in the correct slot when you release it.
- Save and confirm that the new sequence of subfields has been saved.

Perform all the same tests under Administration -> Authority types.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30457: (follow-up) Tweak markup around search form
Owen Leonard [Wed, 20 Apr 2022 15:48:36 +0000 (15:48 +0000)]
Bug 30457: (follow-up) Tweak markup around search form

This patch makes a change to the markup around the patron/clubs search
form on the holds page. This change prevents the Bootstrap tabs from
inheriting an unwanted margin from the fieldset.brief definition.

The change also replaces a <label> tag with an <h2>. I think a heading
makes more sense than a free-floating <label>.

To test, apply the patch and confirm that the holds page
(/cgi-bin/koha/reserve/request.pl?biblionumber=XXX) looks correct.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30457: Convert holds page tabs to Bootstrap
Owen Leonard [Tue, 5 Apr 2022 13:49:53 +0000 (13:49 +0000)]
Bug 30457: Convert holds page tabs to Bootstrap

This patch updates the holds page to replace jQueryUI tabs with
Bootstrap.

To test, apply the patch and begin the process of placing a hold on a
title in the catalog.

If you have one or more patron clubs configured:
 - You should see two tabs, Patrons and Clubs.
 - Both should look correct and work correctly.
 - The Patrons tab should be selected initially, with cursor focus in
   the form field.
 - Switch to the Clubs tab. The cursor focus should move to the form
   field under this tab.
 - Submit a club search which will return results.
 - The page should refresh and the clubs tab should be preselected,
   showing the search results.

If you have no patron clubs configured, the page should show only the
Patrons tab.

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>
2 years agoBug 30454: Convert holds awaiting pickup tabs to Bootstrap
Owen Leonard [Mon, 4 Apr 2022 18:23:00 +0000 (18:23 +0000)]
Bug 30454: Convert holds awaiting pickup tabs to Bootstrap

This patch updates the holds awaiting pickup page to replace jQueryUI
tabs with Bootstrap tabs. A minor JavaScript change is required to work
with the new HTML structure.

To test you should have multiple holds for one library: Some which are
waiting for less than the number of days specified in
ReservesMaxPickUpDelay, some which are waiting longer.

- Apply the patch and go to Circulation -> Holds awaiting pickup.
- You should see two tabs: "Holds waiting" and "Holds waiting over..."
- Confirm that the tabs look correct and work correctly.
- Confirm that the "Cancel selected" buttons work correctly under each
  tab.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30453: Convert offline circulation tabs to Bootstrap
Owen Leonard [Mon, 4 Apr 2022 16:40:20 +0000 (16:40 +0000)]
Bug 30453: Convert offline circulation tabs to Bootstrap

This patch updates the offline circulation page in the staff interface
to use Bootstrap tabs instead of jQueryUI.

To test, apply the patch and make sure the AllowOfflineCirculation
system preference is enabled.

- Go to Circulation -> Built-in offline circulation interface
- Submit a patron barcode in the "Check out" field.
- Under the barcode input field you should see two tabs: Checkouts and
  Fines. Confirm that they look correct and work correctly.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30434: Convert catalog merge page tabs to Bootstrap
Owen Leonard [Fri, 1 Apr 2022 14:30:49 +0000 (14:30 +0000)]
Bug 30434: Convert catalog merge page tabs to Bootstrap

This patch updates the catalog merge template so that it uses Bootstrap
tabs instead of jQueryUI. Some JavaScript is modified to accommodate the
new DOM structure.

The patch also makes a minor HTML correction, adding a missing "</ol>".

To test, apply the patch and search the catalog in the staff client.

- In the search results, check the checkbox for two records.
- Choose Edit -> Merge records.
- Click next to accept the merge reference selection.
- On the next page you should see two tabs under "Source records."
  Confirm that they work correctly.
- All checkboxes in the first tab should be checked by default.
- Confirm that tag and subfield selection still works correctly.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30628: Fix patron selection in batch patron modification tool
Jonathan Druart [Thu, 28 Apr 2022 08:32:28 +0000 (10:32 +0200)]
Bug 30628: Fix patron selection in batch patron modification tool

bug 28014 added Datatables to this view, but the form is submitted with
only the checkboxes from the first page.

Solution adapted from https://stackoverflow.com/questions/33240409/how-to-submit-checkboxes-from-all-pages-with-jquery-datatables

Test plan:
Have more than 20 cardnumbers, use the batch patron modification tool
Select (not all) patrons from the first page and second page
Submit the form
Notice that the patrons you have selected appear on the confirmation
page.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30599: Add an 'Archive selected' button
Nick Clemens [Fri, 22 Apr 2022 19:15:43 +0000 (19:15 +0000)]
Bug 30599: Add an 'Archive selected' button

This patch simply adds a new button on the suggestions interface to allow
for archiving multiple suggestions.

To test:
1 - Apply patch
2 - Create some purchase suggestions
3 - Select several suggestions
4 - Click 'Archive selected'
5 - Suggestions are archived
6 - You can view archived suggestions by selecting 'Suggestion information'->'Include archived'

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Felicity Brown <felicity.brown@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30620: Add a warning about /*!VERSION lines in kohastructure
Marcel de Rooy [Tue, 26 Apr 2022 11:45:52 +0000 (11:45 +0000)]
Bug 30620: Add a warning about /*!VERSION lines in kohastructure

Also adding a similar comment in C4::Installer.

No test plan, just documentation.

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>
2 years agoBug 22379: Unit tests for CancelHold service
Arthur Suzuki [Mon, 27 Jan 2020 04:41:05 +0000 (05:41 +0100)]
Bug 22379: Unit tests for CancelHold service

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22379: Fix checks not made by ILS-DI method CancelHold
Arthur Suzuki [Wed, 20 Feb 2019 20:15:44 +0000 (21:15 +0100)]
Bug 22379: Fix checks not made by ILS-DI method CancelHold

Disable the possibility for a borrower to cancel a reservation
which is either in a Transit or Waiting state.
This reproduce the behaviour seen on the OPAC.
Also replaces previous checks on the borrowernumber
since CanReserveBeCanceledFromOpac already checks this.

--------------------------------

Test plan (before patch) :
-Put a reserve for a borrower
-Try to cancel the reserve providing another borrowernumber as argument
-> Should fail and reply "RecordNotFound"
-> Reserve still appears in the list of holds.

-Try to cancel the reserve providing the borrowernumber the reserve is
for.
-> Should succeed, reply with "Canceled"
-> Reserve do not show up in the list of holds for the borrower

-Put a new reserve with a pickup branch != from the homebranch
-Transfer the item to the pickup branch (reserve status = Transit)
-Try to cancel the reserve (with proper borrowernumber)
-> Should succeed, reply with "Canceled"
-> Reserve do not show up in the list of holds for the borrower

-Checkout the reserved item in the pickup branch (reserve status =
Waiting)
-Try to cancel the reserve (with proper borrowernumber)
-> Should succeed, reply with "Canceled"
-> Reserve do not show up in the list of holds for the borrower

--------------------------------

Test plan (after patch) :
-Put a reserve for a borrower
-Try to cancel the reserve providing another borrowernumber as argument
-> Should fail and reply "BorrowerCannotCancelHold"
-> Reserve still appears in the list of holds.

-Try to cancel the reserve providing the borrowernumber the reserve is
for.
-> Should succeed, reply with "Canceled"
-> Reserve do not show up in the list of holds for the borrower

-Put a new reserve with a pickup branch != from the homebranch
-Transfer the item to the pickup branch (reserve status = Transit)
-Try to cancel the reserve (with proper borrowernumber)
-> Should fail and reply "BorrowerCannotCancelHold"
-> Reserve still appears in the list of holds.

-Checkout the reserved item in the pickup branch (reserve status =
Waiting)
-Try to cancel the reserve (with proper borrowernumber)
-> Should fail and reply "BorrowerCannotCancelHold"
-> Reserve still appears in the list of holds.

Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30597: Update RestrictionBlockRenewing description to include auto renew
Andrew Fuerste-Henry [Fri, 22 Apr 2022 16:12:50 +0000 (16:12 +0000)]
Bug 30597: Update RestrictionBlockRenewing description to include auto renew

To test:
- apply the patch, find the syspref, see the new wording

To confirm the behavior:
- set the syspref to Block
- give a patron an auto-renewing checkout and a restriction
- run automatic_renewal.pl, see item does not renew
- switch syspref to allow, repeat, see renewal

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>
2 years agoBug 30366: Remove warn when running automatic_item_modification_by_age.pl
Fridolin Somers [Mon, 25 Apr 2022 20:27:54 +0000 (10:27 -1000)]
Bug 30366: Remove warn when running automatic_item_modification_by_age.pl

When using the ./misc/cronjobs/automatic_item_modification_by_age.pl -v
after setting up rules under Tools > Automatic item modifications by
age the script outputs several lines of warnings:

Use of uninitialized value in string eq at /kohadevbox/koha/C4/Items.pm
line 1864.

This is because even when there is no condition defined, modification
rule is stored with empty hash, like :
[{"substitutions":[{"field":"items.new_status","value":"0"}],"conditions":[{}],"age":"60","agefield":"items.dateaccessioned"}]

Test plan :
1) Go to Tools > Automatic item modifications by age
2) Create a rule with no conditions, just a substitution
3) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
4) Check there is no warning
5) Edit the rule to add a condition
6) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
7) Check the condition is applied

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30572: DBRev 21.12.00.042
Fridolin Somers [Mon, 2 May 2022 19:37:42 +0000 (09:37 -1000)]
Bug 30572: DBRev 21.12.00.042

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30572: DBIx schema change for SearchMarcToField
Marcel de Rooy [Thu, 21 Apr 2022 12:41:08 +0000 (12:41 +0000)]
Bug 30572: DBIx schema change for SearchMarcToField

No test plan.

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>
2 years agoBug 30572: Dbrev for search_marc_to_field.sort
Marcel de Rooy [Thu, 21 Apr 2022 12:42:53 +0000 (12:42 +0000)]
Bug 30572: Dbrev for search_marc_to_field.sort

Test plan:
Run updatedatabase.

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>
2 years agoBug 30572: Adjust search_marc_to_field.sort in kohastructure
Marcel de Rooy [Thu, 21 Apr 2022 12:29:48 +0000 (12:29 +0000)]
Bug 30572: Adjust search_marc_to_field.sort in kohastructure

Test plan:
New install or run kohastructure on empty database.

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>
2 years agoBug 30449: DBRev 21.12.00.041
Fridolin Somers [Mon, 2 May 2022 19:31:51 +0000 (09:31 -1000)]
Bug 30449: DBRev 21.12.00.041

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30449: (QA follow-up) Report back on problematic situations
Tomas Cohen Arazi [Mon, 25 Apr 2022 13:09:41 +0000 (10:09 -0300)]
Bug 30449: (QA follow-up) Report back on problematic situations

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>
2 years agoBug 30449: DBIC updates
Tomas Cohen Arazi [Mon, 25 Apr 2022 12:51:24 +0000 (09:51 -0300)]
Bug 30449: DBIC updates

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>
2 years agoBug 30449: Add missing FK constraint on borrower_attribute_types
Marcel de Rooy [Mon, 4 Apr 2022 13:20:37 +0000 (13:20 +0000)]
Bug 30449: Add missing FK constraint on borrower_attribute_types

Old Koha databases probably have it, newer ones might not.
See also BZ description.

Test plan:
[1} Check SHOW CREATE TABLE borrower_attribute_types to see if you
    have any index and FK constraint on category_code.
[2] Run updatedatabase.
[3] If you had category_code_fk, it should be replaced.
[4] Remove index and constraint again using things like:
    alter table borrower_attribute_types drop constraint `borrower_attribute_types_ibfk_1`;
    alter table borrower_attribute_types drop index category_code;
[5] Run updatedatabase.
[6] You should have KEY category_code and FK borrower_attribute_types_ibfk_1.
[7] Run updatedatabase. Idempotent, no changes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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>
2 years agoBug 30610: Update on click binding for print receipt
Martin Renvoize [Mon, 25 Apr 2022 14:37:33 +0000 (15:37 +0100)]
Bug 30610: Update on click binding for print receipt

This patch updates the binding for the on click even of the print
receipt button so that subsequent pages in the datatable work with the
reciept printing button.

Test plan
1) Enable cash management and process enough transactions to display
   more than one page of transactions in the register details page.
2) Confirm the 'Print receipt' button works on the first page of
   transactions
3) Confirm the 'Print receipt' button works on subsequent transactions
   pages in the datatable.
4) Confirm the same for the past transactions table.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30565: DBRev 21.12.00.040
Fridolin Somers [Mon, 2 May 2022 19:25:58 +0000 (09:25 -1000)]
Bug 30565: DBRev 21.12.00.040

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30565: DBIx schema change for stockrotationrotas
Marcel de Rooy [Wed, 20 Apr 2022 11:37:31 +0000 (11:37 +0000)]
Bug 30565: DBIx schema change for stockrotationrotas

No test plan.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30565: Database revision for stockrotationrotas
Marcel de Rooy [Wed, 20 Apr 2022 11:29:58 +0000 (11:29 +0000)]
Bug 30565: Database revision for stockrotationrotas

Add unique key if needed.
Adjust description column to make it NOT NULL.

Test plan:
(Optionally:) Drop unique key, make description nullable.
Run dbrev.
Check if unique key present, and description not-nullable.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30565: Correct kohastructure
Marcel de Rooy [Wed, 20 Apr 2022 11:22:15 +0000 (11:22 +0000)]
Bug 30565: Correct kohastructure

The unique key was added in a dbrev and is referred to in code.
But forgotten in kohastructure.

Test plan:
Run new install or kohastructure.sql on empty db.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24001: (follow-up) Fix t_Profile.t
Fridolin Somers [Fri, 29 Apr 2022 06:24:45 +0000 (20:24 -1000)]
Bug 24001: (follow-up) Fix t_Profile.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30576: (follow-up) Corrections to behaviour to reflect unit tests
Martin Renvoize [Fri, 22 Apr 2022 14:19:29 +0000 (15:19 +0100)]
Bug 30576: (follow-up) Corrections to behaviour to reflect unit tests

The unit tests highlighted my original patch didn't cover the full
preference description.

We now replace the 'standard' option with the fields from the preference
and we also add those fields as options to the field selection in
advanced searches.

This patch also adjusts the tests to test for that and reflects the
expected changes to the number of options displayed in the select boxes.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30576: Use DefaultPatronSearchFields in patron search
Martin Renvoize [Thu, 21 Apr 2022 11:52:32 +0000 (12:52 +0100)]
Bug 30576: Use DefaultPatronSearchFields in patron search

This patch corrects the handling of the 'Standard' search field in
patron searches such that it accurately reflects the contents of the
DefaultPatronSearchFields system preference and falls back to a hard
coded list instead of always using the hard coded list.

To test:
1) Empty the contents of DefaultPatronSearchFields systempreference
2) Perform a patron search from the header search
3) Inspect the patrons API request and note that we search on the
   default fallback fields of firstname, surname, othernames,
   cardnumber and userid (and some extended attributes which are
   historically hard coded).
4) Navigate to the memebers-home by clicking the 'Patrons' button from
   the main page
5) Perform another search using the filters on the left with 'Standard'
   selected.
6) Note the same list of search fields used as above in the patrons API
   request.
7) Update the DefaultPatronSearchFields systempreference adding one or
   more borrower fields in a comma delimited list.
8) Repeat steps 2 -> 6 but this time upon inspecting the API request you
   should find that only the fields in your DefaultPatronSearchFields
   list are searched (along with the hard coded extended attributes
   list).
9) Signoff

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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30626: Don't generate the query if no term passed
Jonathan Druart [Thu, 28 Apr 2022 13:00:29 +0000 (15:00 +0200)]
Bug 30626: Don't generate the query if no term passed

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30626: (QA follow-up) Fix test plan
Martin Renvoize [Wed, 27 Apr 2022 10:52:21 +0000 (11:52 +0100)]
Bug 30626: (QA follow-up) Fix test plan

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30626: Fix test
Jonathan Druart [Wed, 27 Apr 2022 10:34:11 +0000 (12:34 +0200)]
Bug 30626: Fix test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30626: DT REST API wrapper - Fix general search
Jonathan Druart [Wed, 27 Apr 2022 10:33:03 +0000 (12:33 +0200)]
Bug 30626: DT REST API wrapper - Fix general search

The general search query is not built correctly.

Say you have a table with column filters, like the main patron search:
General filter: henry
Specific filter on the 'Name' column: h

The generated query will be (= are actually LIKE):
{ Column1="henry" AND Column3="henry", ...} AND { Column2="h" }

The first term does not contain the Column2 attribute.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30630: Prevent crash on check-in if HoldsAutoFill is ON
Jonathan Druart [Thu, 28 Apr 2022 07:43:06 +0000 (09:43 +0200)]
Bug 30630: Prevent crash on check-in if HoldsAutoFill is ON

RevertWaitingStatus has already removed the itemnumber from the hold, passing $itemnumber (from scanned item) should work, as it will reattach the hold to the item

Test plan:
1 - Enable HoldsAutoFill
2 - Place a title level hold
3 - Check in an item and confirm hold
4 - Switch to another branch
5 - Checkin the item
Without this patch you got
Can't call method "biblionumber" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1577.
 at /kohadevbox/koha/C4/Reserves.pm line 1576
With this patch applied the operation succeeds

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24001: Fix Card template/rpinter profile creation and edit
Nick Clemens [Fri, 4 Mar 2022 16:19:35 +0000 (16:19 +0000)]
Bug 24001: Fix Card template/rpinter profile creation and edit

This patch adjusts the template/profiles to use the default of '0'
This should probably be NULL, and the columns foreign keys, this code
could use a further rewrite, but this should fix a long standing bug

To test:
 1 - Using the fresh install, with all the sample data.
 2 - Go to Home › Tools › Patron card creator › Templates
 3 - New > Card template
 4 - Save
 5 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'profile_id' at row 1
 6 - Edit an existing template
 7 - Save
 8 - Error: Can't bless non-reference value at /kohadevbox/koha/C4/Creators/Profile.pm line 89
 9 - Create a new 'Printer profile'
10 - Save
11 - Error: DBD::mysql::st execute failed: Incorrect integer value: '' for column 'template_id' at row 1
12 - Apply the attached patch.
13 - Verify you can create a new 'Card template' and 'Printer profile' with no errors
14 - Verify you can edit and save both of the newly created objects above

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24001: Fix patron card template edition
Blou [Tue, 30 Jun 2020 16:50:09 +0000 (12:50 -0400)]
Bug 24001: Fix patron card template edition

Error when saving Patron card Template:
Can't bless non-reference value at
/home/vagrant/kohaclone/C4/Creators/Profile.pm line 89

This is caused by the profile dropdown offering invalid choices and is
fixed by adding a filter to limit options to creator = 'Patroncards'.
The UI already handles the case where no valid profile is avaiable.

Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30644: (bug 29788 follow-up) Make Koha::Item->safe_to_delete use Koha::Result...
Jonathan Druart [Thu, 28 Apr 2022 13:44:16 +0000 (15:44 +0200)]
Bug 30644: (bug 29788 follow-up) Make Koha::Item->safe_to_delete use Koha::Result::Boolean

Fix item deletion

Wrong if/else!

Test plan:
Delete an item

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>