koha-ffzg.git
23 months agoBug 30716: Add collection to cn_browser results
Lucas Gass [Fri, 6 May 2022 21:50:05 +0000 (21:50 +0000)]
Bug 30716: Add collection to cn_browser results

To test:
1. Go to MARC bibliographic framework, pick a framework and go to 952, subfield "o". Turn the cn_browser plugin on.
2. Pick or create an item in that framework, edit that item.
3. TO the right of the 952$o notice the "...". Click that start the call number browser.
4. Notice there is no column for collection.
5. Apply patch, restart_all
6. Notice there is now a column for with the items collection.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR
Katrin Fischer [Mon, 6 Jun 2022 21:34:26 +0000 (21:34 +0000)]
Bug 30567: Fix price formatting when adding a manual invoice with CurrencyFormat FR

In input fields we always use the decimal . while the display format
uses the decimal separtor definded by CurrencyFormat. When adding a
manual invoice without this patch, the amount is shown with comma, but
it should be . in the input field.

To test:
1- Go in Administration->Debit types
2- Click on New debit type
3- Fill the form:
   Code: USEDBOOK
   Default amount: 0.50
   Description: Used book
   Can be manually invoiced: Yes
4- Save
5- Go to any patron account
6- Go to the "Accounting" tab
7- Click on "Create manual invoice"
8- Fill the form
9- Choose the created debit (Used book)
10- Verify that the format is incorrect (0,50 instead of 0.50)
11- Apply the patch
12- Verify the amount is now using the correct format

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30566: Incorporate link handling in OPAC's biblio-title include
Owen Leonard [Tue, 19 Apr 2022 15:31:41 +0000 (15:31 +0000)]
Bug 30566: Incorporate link handling in OPAC's biblio-title include

This patch modifies the biblio-title include so that it can be used to
link to the bibliographic record using the default biblio view.

On pages where the biblio-title include was wrapped in an anchor tag, a
link parameter is added: [% INCLUDE 'biblio-title.inc' link=> 1 %]

To test, apply the patch and view the following pages in the OPAC to
confirm that titles are displayed correctly and that the link to the
bibliographic record is correct:

- Log in to the OPAC: On the "your summary" page, check checkouts,
  overdues, holds, and article requests.
- Check the "your holds history" page.
- Locate a bibliographic record and click "Save to your lists."
  In the popup, the title should be displayed correctly without a link.
- Place a hold, and check the hold confirmation page.
- Check the "Recent comments" page.
- Locate a record which has a local cover image attached, and view the
  image.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30990: Fix DefaultHoldPickupLocation system preference description
Katrin Fischer [Fri, 17 Jun 2022 20:20:08 +0000 (22:20 +0200)]
Bug 30990: Fix DefaultHoldPickupLocation system preference description

Changes:
* branch to library
* staff client to staff interface
* adds an ending .

To test:
- Compare system preference descrpition before and after the
  patch was applied.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: (follow-up) Fix tests count
Tomas Cohen Arazi [Tue, 5 Jul 2022 12:53:29 +0000 (09:53 -0300)]
Bug 30275: (follow-up) Fix tests count

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: DBRev 22.06.00.011
Tomas Cohen Arazi [Tue, 5 Jul 2022 12:50:05 +0000 (09:50 -0300)]
Bug 30275: DBRev 22.06.00.011

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Unit Tests for Checkouts::Renewal
Martin Renvoize [Thu, 28 Apr 2022 12:13:24 +0000 (13:13 +0100)]
Bug 30275: Unit Tests for Checkouts::Renewal

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add Unit test for renewals relation
Martin Renvoize [Thu, 28 Apr 2022 10:55:32 +0000 (11:55 +0100)]
Bug 30275: Add Unit test for renewals relation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add unit tests for AddRenewal addition
Martin Renvoize [Thu, 28 Apr 2022 10:35:54 +0000 (11:35 +0100)]
Bug 30275: Add unit tests for AddRenewal addition

This patch adds a test for the AddRenewal addition that creates Renewal
lines.

Test plan
1) Run the unit tests and confirm it passes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: (follow-up) Drop renewer_id constraint
Martin Renvoize [Thu, 28 Apr 2022 08:28:50 +0000 (09:28 +0100)]
Bug 30275: (follow-up) Drop renewer_id constraint

This patch fixes some unit tests by ensureing we set a valid userid for
mock userenv setting so that the foreign key constraint doesn't fail and
it also removes the exception class and check for renewer_id from the
store method as, for example with autorenewals, the renewal may not have
been triggered by a actual user.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: (QA follow-up) Rename columns to match API
Tomas Cohen Arazi [Wed, 27 Apr 2022 20:07:01 +0000 (17:07 -0300)]
Bug 30275: (QA follow-up) Rename columns to match API

This patch performs the following column renames:

* id => renewal_id
* issue_id => checkout_id

The idea is that no translation is needed for the API, and also, being a
new table, we can educate the users into the 'to be' terminology we are
leaning towards, instead of having them learn one naming to create
reports and then need to translate them once we normalize things in a
future.

That said, this is simple to review.

Apply this patch and repeat the test plan.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add renewals relation to Koha::Old::Checkout
Martin Renvoize [Tue, 26 Apr 2022 14:56:45 +0000 (15:56 +0100)]
Bug 30275: Add renewals relation to Koha::Old::Checkout

Add the new 'renewals' relation to Koha::Old::Checkout to return a
list of Koha::Checkouts::Renewal objects.

We also add the same relation to the OldIssue schema inline.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: (follow-up) Rebase fixes
Martin Renvoize [Tue, 26 Apr 2022 14:33:53 +0000 (15:33 +0100)]
Bug 30275: (follow-up) Rebase fixes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add basic unit test for fetching renewals
Martin Renvoize [Fri, 18 Mar 2022 14:10:44 +0000 (14:10 +0000)]
Bug 30275: Add basic unit test for fetching renewals

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Fix checkouts.t unit test
Martin Renvoize [Fri, 18 Mar 2022 13:57:32 +0000 (13:57 +0000)]
Bug 30275: Fix checkouts.t unit test

We no longer require a mocked userenv for these tests to pass, we're
setting the userenv in api auth now. The mock just serves to break tests
for the renew method now that AddRenewal required a correctly set
userenv for 'number'.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add alias to create renewal in api routes
Martin Renvoize [Fri, 11 Mar 2022 16:17:16 +0000 (16:17 +0000)]
Bug 30275: Add alias to create renewal in api routes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add `/api/v1/checkouts/{checkout_id}/renewals`
Martin Renvoize [Fri, 11 Mar 2022 14:05:25 +0000 (14:05 +0000)]
Bug 30275: Add `/api/v1/checkouts/{checkout_id}/renewals`

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add renewals relation to Koha::Checkout
Martin Renvoize [Fri, 11 Mar 2022 15:39:43 +0000 (15:39 +0000)]
Bug 30275: Add renewals relation to Koha::Checkout

Add the new 'renewals' relation to Koha::Checkout to return a list of
Koha::Checkouts::Renewal objects.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add 'renewals' relation to Issue Schema
Martin Renvoize [Fri, 11 Mar 2022 14:05:48 +0000 (14:05 +0000)]
Bug 30275: Add 'renewals' relation to Issue Schema

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: renewals_count DBIC Update
Martin Renvoize [Fri, 11 Mar 2022 15:22:01 +0000 (15:22 +0000)]
Bug 30275: renewals_count DBIC Update

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Rename issues.renewals to issues.renewals_count
Martin Renvoize [Fri, 11 Mar 2022 15:04:06 +0000 (15:04 +0000)]
Bug 30275: Rename issues.renewals to issues.renewals_count

Rename the issues.renewals field to renewals_count to prevent a method
name collision with the new relation accessor introduced by this
patchset.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add Koha::Objects for Renewals
Martin Renvoize [Fri, 11 Mar 2022 13:32:20 +0000 (13:32 +0000)]
Bug 30275: Add Koha::Objects for Renewals

Add Koha::Checkouts::Renewals|Renewal classes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: DBIC Schema Additions
Martin Renvoize [Fri, 11 Mar 2022 13:31:53 +0000 (13:31 +0000)]
Bug 30275: DBIC Schema Additions

Add checkout and old_checkout relations to CheckoutRenewal schema and
mark 'seen' as a boolean.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Record renewals
Martin Renvoize [Fri, 11 Mar 2022 16:02:47 +0000 (16:02 +0000)]
Bug 30275: Record renewals

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: DBIC Schema Changes
Martin Renvoize [Fri, 11 Mar 2022 13:07:59 +0000 (13:07 +0000)]
Bug 30275: DBIC Schema Changes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Generated kohastructure.sql
Martin Renvoize [Fri, 11 Mar 2022 13:04:24 +0000 (13:04 +0000)]
Bug 30275: Generated kohastructure.sql

This kohastructure update was generated using `koha-dump --schema-only`
in koha-testing-docker once the atomicupdate had been run against the
previous atomicupdate patch.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30275: Add checkout_renewals table
Martin Renvoize [Fri, 11 Mar 2022 15:05:23 +0000 (15:05 +0000)]
Bug 30275: Add checkout_renewals table

This patch adds the new checkout_renewals table using an atomicupdate

Sponsored-by: Loughborough University
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30785: Fixed typo in SIP2SortBinMapping
Isobel Graham [Thu, 30 Jun 2022 16:16:08 +0000 (17:16 +0100)]
Bug 30785: Fixed typo in SIP2SortBinMapping

To test:
1. Go to the admin page.
2. Search for the above preference.
3. Confirm that "Will" is now spelled correctly.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 26311: (QA follow-up) Update script documentation
Katrin Fischer [Sat, 2 Jul 2022 21:59:14 +0000 (21:59 +0000)]
Bug 26311: (QA follow-up) Update script documentation

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 26311: (follow-up) Fix undefined values in sprintf
Fridolin Somers [Tue, 28 Jun 2022 06:08:33 +0000 (20:08 -1000)]
Bug 26311: (follow-up) Fix undefined values in sprintf

Avoid warns 'Use of uninitialized value in sprintf' by using
'0' if lower age is undefined
'unlimited' if upper are is undefined

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 26311: (follow-up) loop through the patron with date of birth and in categories...
Fridolin Somers [Wed, 30 Sep 2020 09:51:22 +0000 (11:51 +0200)]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits

Also added category limits in message, for example (12-18)

Check patron :
- with no date of birth
- with invalid age in category having age required
- with invalid age in category having upper age limit
- with invalid age in category having age required and upper age limit

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 26311: (QA follow-up) Rephrase output message
Katrin Fischer [Mon, 14 Sep 2020 07:07:01 +0000 (07:07 +0000)]
Bug 26311: (QA follow-up) Rephrase output message

This is a suggestion for rephrasing the message slightly:

Before:
* Patron borrowernumber=15 in category 'J' has invalid age '56'

After:
* Patron borrowernumber=37 has an invalid age of 37 for their category 'K'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 26311: Add patron invalid age to search_for_data_inconsistencies.pl
Fridolin Somers [Thu, 27 Aug 2020 15:21:14 +0000 (17:21 +0200)]
Bug 26311: Add patron invalid age to search_for_data_inconsistencies.pl

Patron categories may have age limits.
Add to script misc/maintenance/search_for_data_inconsistencies.pl the list of patrons which age is invalid regarding there category.

Test plan :
1) Create an adult patron category limited to 18-99 years
2) Create a patron in the category
3) Edit in database its date of birth so that he is 17 years old
4) Run misc/maintenance/search_for_data_inconsistencies.pl
=> You see the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 31040: jsTree image being used outside of jsTree plugin
Owen Leonard [Fri, 24 Jun 2022 11:44:09 +0000 (11:44 +0000)]
Bug 31040: jsTree image being used outside of jsTree plugin

This patch corrects OPAC templates which tried to use a jsTree image
asset which is missing following the jsTree upgrade (see Bug 11873).
Templates should use /images/spinner-small.gif instead.

To test, apply the patch and enable OpenLibrarySearch and populate
OverDrive and RecordedBooks preferences with credentials (they don't
have to be valid).

Perform a catalog search in the OPAC. When the search results page first
loads you should see messages about the services being queried:

Searching OpenLibrary...
Searching RecordedBoks...
Searching OverDrive...

Each should show a working "spinner" image while the queries are being
performed. If you have valid OverDrive credentials you can try clicking
through to the OverDrive search results page to confirm that the image
is working on that page too.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 31066: Update javascript to use 'text_plugin' type for regex option
Nick Clemens [Wed, 29 Jun 2022 11:23:22 +0000 (11:23 +0000)]
Bug 31066: Update javascript to use 'text_plugin' type for regex option

To test:
 1 - Confirm 952$o is not linked to a plugin in the default marc framework
 2 - Send some tiems to batch modification
 3 - Confirm you can select RegEx as an option for callnumber during modification
 4 - Link 952$o to the cn_browser.pl plugin
 5 - Repeat batch modification
 6 - Note there is no regex option
 7 - Apply patch
 8 - Confirm there is a regex option
 9 - Unlink 952$o from plugin
10 - Confirm you still have a regex option in batch modification

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 29958: Do not set dateaccessioned on updates
Martin Renvoize [Fri, 24 Jun 2022 14:39:07 +0000 (15:39 +0100)]
Bug 29958: Do not set dateaccessioned on updates

This patch reomves the second occurence of setting daeaccessioned today,
outside of the 'add/update' handling in Koha::Item->store.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 29958: Regression tests
Tomas Cohen Arazi [Tue, 5 Jul 2022 12:14:16 +0000 (09:14 -0300)]
Bug 29958: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 25622: Use special chars in DB password (koha-create)
Jonathan Druart [Fri, 29 May 2020 14:10:58 +0000 (16:10 +0200)]
Bug 25622: Use special chars in DB password (koha-create)

On bug 23250 we decided to generate a password without special chars
then add a '@' at the end to comply with MySQL policy.
That is wrong, we should handle correctly the special chars we don't
want to be part of the password.

Test plan:
1.
mysqlpwd=$(pwgen -s -y -r ":'&\\<>/" 16 1)
echo $mysqlpwd

Confirm that you don't see one of the following chars : ' & \ < > /

2.
Copy from src and edit /usr/sbin/koha-create to add an echo $mysqlpwd
Create several instances, like:
koha-create --create-db x
koha-create --create-db xx
koha-create --create-db xxx
...

When you see a password with a special chars, do:
koha-shell xxx
grep '<pass>' $KOHA_CONF
And make sure the password does not contain "__DB_PASS__"

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30152: Elasticsearch - queries with OR don't work with limits
Kevin Carnes [Tue, 22 Feb 2022 13:29:15 +0000 (14:29 +0100)]
Bug 30152: Elasticsearch - queries with OR don't work with limits

When a query with "OR" is combined with a limit in Elasticsearch, the precedence is not preserved and the results are not correct.

To test:
1) Set SearchEngine to Elasticsearch
2) Index records in Elasticsearch
3) Do an advanced search
4) Select More options
5) Enter a value for the first Keyword (e.g. Novels)
6) Change "and" before the second Keyword to "or"
7) Enter another value for the second Keyword (e.g. Prose)
8) Limit the search (e.g. Item type Books)
9) Do the search
10) Observe that records with the first keyword are not in the results
11) Apply the patch
12) Repeat the search
13) Observe that results with both keywords are in the results
14) Sign off

Sponsored-by: Lund University Library
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30430: (QA follow-up) Several fixes
Fridolin Somers [Thu, 30 Jun 2022 04:40:35 +0000 (18:40 -1000)]
Bug 30430: (QA follow-up) Several fixes

Several fixes :

- Replace tab with spaces

tag_210 :
- Class 'value' and not 'valeur'
- Loop on subfields must restrict to abcdg otherwise last() may not be
  correct (ie 214r and 214s)

tag_214 :
- Condition for coma after b should be same as after a : "position() != last()"

tag_210 and tag_214 :
- Space before ':' like in other fields
- ':' before c or g does not exist in opac, removed from intranet file
- Search links in intranet fixed (where composed with opac-search ^^)
- Search links using 'str:encode-uri' like other places
- Simplify title attribute with only 'Search for publisher' => Bad idea
  to use double quotes in a text

tag_214_s and tag_214_r :
- Loop on field+subfield otherwise last() may not be correct

I've fixed intranet and copied to OPAC (only adapted search links)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30430: (QA follow-up) fix display of 210 only if no 214 + added 214r/s
Arthur Suzuki [Thu, 5 May 2022 15:29:51 +0000 (17:29 +0200)]
Bug 30430: (QA follow-up) fix display of 210 only if no 214 + added 214r/s

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30430: UNIMARC XSLT add field B214 display
François Pichenot [Wed, 13 Apr 2022 11:20:11 +0000 (13:20 +0200)]
Bug 30430: UNIMARC XSLT add field B214 display

test plan :
- Apply patch
- Find a record with a B214
- Check on both Opac-Details and Opac-Result that the field is
  displayed.
- Do the same checks on catalogue/search results and catalogue/details
  in Staff interface.
- Add a 210 field to the record (legacy)
- It should be displayed as well

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30859: Upgrade jQuery Validation plugin from v1.19.1 to v1.19.4
Owen Leonard [Fri, 13 May 2022 17:12:36 +0000 (17:12 +0000)]
Bug 30859: Upgrade jQuery Validation plugin from v1.19.1 to v1.19.4

This patch updates the jQuery Validation plugin in both the OPAC and
staff interface. This upgrade brings the plugin to the current latest
version (1.19.4) which includes compatibility fixes for the latest
version of jQuery.

To test, apply the patch and test various forms in the OPAC and staff
interface to confirm that validation is still working correctly.

In the OPAC:

- Patron self-registration: Required fields, password match
  and complexity. Test also the "Forgot password" and "Change password"
  interfaces.

In the staff interface, for example:

- Patrons -> Patron password change: Required fields, password match and
  complexity.
- Administration -> Patron categories -> New category:
  - Required fields
  - One or the other enrollment period inputs
  - Digits required in password expiration, age required, upper age
    limit
  - Numbers required in enrollment and hold fee.
- Administration -> Budgets -> New budget:
  - Required fields
  - End date must be after start date
- Administration -> Cities & towns: Required fields

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2 years agoBug 31062: Change description of QOTD tool in tools-home
Caroline Cyr La Rose [Wed, 29 Jun 2022 15:12:57 +0000 (11:12 -0400)]
Bug 31062: Change description of QOTD tool in tools-home

This patch changes the name and description of the QOTD tool in order
to make them more consistent with the other tool names and descriptions.

To test:
1) Go to Tools
2) Read the QOTD tool name and description, make sure they make
   sense and that there are no typos
3) Test the link to make sure it goes to the tool

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2 years agoBug 31064: Wrap local login with stylable element
David Cook [Wed, 29 Jun 2022 08:46:21 +0000 (08:46 +0000)]
Bug 31064: Wrap local login with stylable element

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OPACUserCSS
2. Set syspref to the following:
.local-login {
      display: none;
}
3. Go to http://localhost:8080/cgi-bin/koha/opac-main.pl
3b. Note that the local login boxes are hidden
    ("Log in to your account:" remains so that other login options can
    be supplied by OpacUserJS)

4. Click on "Log in to your account" on the top toolbar
4b. Note that the local login boxes are hidden
    ("Log in to your account:" remains so that other login options can
    be supplied by OpacUserJS)

5. Go to http://localhost:8080/cgi-bin/koha/opac-user.pl
5b. Note that the local login boxes are hidden
    ("Log in to your account" remains so that other login options can be
    supplied by OpacUserJS)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30823: DBRev 22.06.00.010
Tomas Cohen Arazi [Fri, 1 Jul 2022 19:13:52 +0000 (16:13 -0300)]
Bug 30823: DBRev 22.06.00.010

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30823: Filling recalls uses 'FILL' action in action logs
Aleisha Amohia [Mon, 6 Jun 2022 23:52:59 +0000 (23:52 +0000)]
Bug 30823: Filling recalls uses 'FILL' action in action logs

This enhancement changes recall fulfillment actions to log with the
FILL action. It will also update existing recalls FULFILL actions in
the database to use the FILL action.

To test:
1) Enable the UseRecalls system preference and set up your
recalls-related circulation rules. Confirm RecallsLog is enabled.
2) Check out an item to Patron B.
3) Log into the OPAC as Patron A and search for the item.
4) Place a recall on that item.
5) Go back to the staff client and check the item in. Confirm the recall
as waiting for Patron A.
6) Check out the item for Patron A to fill the recall.
7) Go to Tools -> Log Viewer. Confirm there is a FULFILL action. Choose
the following search params to browse system logs:
- modules: recalls
- actions: fill
8) Submit the search and confirm the recall DOES NOT show.
9) Apply the patch, update database, restart services.
10) Refresh the log viewer and repeat step 7. Submit the search and
confirm the recall DOES show. Confirm there is no longer a FULFILL
action as both holds and recalls will use FILL.
11) Check in the item.
12) Repeat steps 2-6. We are ensuring that future recalls are logged
using the FILL action.
13) Repeat step 7. Confirm all test recalls are now showing in search
results.

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 31085: Reload return claims table on resolve
Martin Renvoize [Mon, 27 Jun 2022 16:53:15 +0000 (17:53 +0100)]
Bug 31085: Reload return claims table on resolve

This is another fix for a bug in return claims. We now test for the
initialised datatable and call an ajax reload directly on it if we find
one instead of calling a undefined function (the function is out of
scope here).

NOTE: Taken as a whole commit follow-up on bug 28854 where the issue was
initially identified

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 31087: Prevent stringification of null in return claims
Martin Renvoize [Mon, 27 Jun 2022 16:20:55 +0000 (17:20 +0100)]
Bug 31087: Prevent stringification of null in return claims

The return claims table was stringifying 'null'. This patch updates the
code to check for definition so we don't stringify incorrectly

Note: This patch was split out from a follow-up on bug 28854 as we felt
it should be treated separately for backportability.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: (follow-up) Warn if context is not defined
Tomas Cohen Arazi [Fri, 1 Jul 2022 13:21:58 +0000 (10:21 -0300)]
Bug 30889: (follow-up) Warn if context is not defined

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30865: Double-quote Host-item in Koha::Biblio->get_components_query
David Cook [Mon, 30 May 2022 03:31:44 +0000 (03:31 +0000)]
Bug 30865: Double-quote Host-item in Koha::Biblio->get_components_query

This patch adds double quotes around the term qualified by "Host-item"
in Koha::Biblio->get_components_query().

Without them, reserved charactrs like "=" will cause syntax errors like
"CCL parsing error (10014) Unknown qualifier ZOOM for query:
    Host-item=(MyTitle = Mysubtitle)
    at /usr/share/koha/lib/C4/Search.pm line 245."

Test plan:
0) Don't apply the patch
1) Create biblio with title and subtitle like (MyTitle : MySubtitle)
2) Note the warning "There was an error searching for analytic records,
   please see the logs for details." on the detail page
3) Apply the patch
4) koha-plack --restart kohadev
5) Refresh the detail page
6) Note that the warning message is gone
7) prove t/db_dependent/Koha/Biblio.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30744: Use RecordProcessor in get_marc_notes
Martin Renvoize [Wed, 25 May 2022 14:51:41 +0000 (15:51 +0100)]
Bug 30744: Use RecordProcessor in get_marc_notes

This patch utilises RecordProcessor to filter the MARC::Record for the
right interface prior to constructing the marc notes array.  We also
remove the use of C4::XSLT for replacing AV values in the MARC fields in
preference to using the RecordProcessor filter.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30918: Allow passing filtered record to get_marc_notes
Martin Renvoize [Tue, 7 Jun 2022 12:45:14 +0000 (13:45 +0100)]
Bug 30918: Allow passing filtered record to get_marc_notes

This patch does the absolute bare minimum to prevent private notes from
appearing on the OPAC.

Test plan
1. Go to Koha Administration -> Koha bibliographic frameworks
2. View the MARC structure for your BKS framework (or something else)
3. Search for tag 583, edit subfields
4. Go to subfield 'x' - nonpublic note. Confirm the OPAC visibility
   checkbox is UNCHECKED.
5. Edit or create a record using the BKS framework. Put a note in the
   583$x.
6. View this record in the OPAC
7. Go to the Title notes tab. Confirm the non-public note is
   showing, even though the framework says it should not be
   visible via the OPAC.
8. Apply patch
9. Confirm the non-public note is no longer visible

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30848: Add exec flag to test
Nick Clemens [Fri, 17 Jun 2022 13:09:02 +0000 (13:09 +0000)]
Bug 30848: Add exec flag to test

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30848: Fix issue exposed by unit tests
Martin Renvoize [Mon, 13 Jun 2022 13:26:33 +0000 (14:26 +0100)]
Bug 30848: Fix issue exposed by unit tests

This patch changes the 'map' to a simple for loop so that we can easily
map multiple subfields to a field without overwriting the first previous
subfields in the structure.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30848: Expand unit tests
Martin Renvoize [Mon, 13 Jun 2022 13:25:30 +0000 (14:25 +0100)]
Bug 30848: Expand unit tests

Add to the unit tests to test Library and Itemtype expansions as well as
linking multiple subfields of the same marc field to such expansions.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30848: Add an ExpandCodedFields RecordProcessor filter
Martin Renvoize [Thu, 26 May 2022 09:24:50 +0000 (10:24 +0100)]
Bug 30848: Add an ExpandCodedFields RecordProcessor filter

This patch introduces a RecordProcessor filter for MARC::Record objects
that replaces Koha codes with descriptions in the MARC::Record passed to the processor.

Target usage:

  my $biblio = Koha::Biblios->find(
      $biblio_id,
      { prefetch => [ metadata ] }
  );

  my $record = $biblio->metadata->record;

  my $processor = Koha::RecordProcessor->new(
    {
        filters => ('ExpandCodedFields'),
        options => {
            interface     => 'opac',
            frameworkcode => $biblio->frameworkcode
        }
    }
  );

  $processor->process( $record );

Test plan
* Read the included unit test and confirm it makes sense and passes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: DBRev 22.06.00.009
Tomas Cohen Arazi [Fri, 1 Jul 2022 12:14:18 +0000 (09:14 -0300)]
Bug 30889: DBRev 22.06.00.009

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: Schema update
Tomas Cohen Arazi [Thu, 30 Jun 2022 14:54:10 +0000 (11:54 -0300)]
Bug 30889: Schema update

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: Add comment for the new DB field
Tomas Cohen Arazi [Thu, 30 Jun 2022 14:52:52 +0000 (11:52 -0300)]
Bug 30889: Add comment for the new DB field

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: Unit tests - process
Martin Renvoize [Mon, 20 Jun 2022 15:27:51 +0000 (16:27 +0100)]
Bug 30889: Unit tests - process

This patch adds corresponding unit tests for the 'process' side of this
patchset. We check that the Context for the job to run in as set from
the Job context recorded at enqueue time.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: Unit tests
Martin Renvoize [Mon, 20 Jun 2022 15:01:28 +0000 (16:01 +0100)]
Bug 30889: Unit tests

This patch adds a unit test for the 'enqueue' part of the bug. We check
that the mocked context (and interface) are recorded with the job
enqueue in the new 'context' field.

We do not yet test the 'process' end, where we then read the context out
and set the job Context from it.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: Fix atomic update permissions
Kyle M Hall [Fri, 17 Jun 2022 18:00:36 +0000 (18:00 +0000)]
Bug 30889: Fix atomic update permissions

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: (follow-up) Record and use context in background_jobs
Martin Renvoize [Fri, 10 Jun 2022 13:09:21 +0000 (14:09 +0100)]
Bug 30889: (follow-up) Record and use context in background_jobs

This patch records the current context to the background_jobs table at
enqueue time and then uses that record to set the context at process
time.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: (follow-up) Add context field to background_jobs
Martin Renvoize [Fri, 10 Jun 2022 13:06:22 +0000 (14:06 +0100)]
Bug 30889: (follow-up) Add context field to background_jobs

This patch adds a new 'context' field to the background_jobs table to
record the context in which the job was queued.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: Set interface to 'intranet'
Jonathan Druart [Tue, 7 Jun 2022 12:41:14 +0000 (14:41 +0200)]
Bug 30889: Set interface to 'intranet'

Is that correct?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30889: Set userenv for background jobs
Jonathan Druart [Tue, 7 Jun 2022 12:39:44 +0000 (14:39 +0200)]
Bug 30889: Set userenv for background jobs

We need to set the userenv when we process the jobs. It is useful for
stats (at least)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 31058: Fix import AutoUnsuspendHolds
Nick Clemens [Tue, 28 Jun 2022 10:06:57 +0000 (10:06 +0000)]
Bug 31058: Fix import AutoUnsuspendHolds

This patch corrects missing import

To test:
1 - perl misc/cronjobs/holds/auto_unsuspend_holds.pl
2 - It dies
Undefined subroutine &main::AutoUnsuspendReserves called at misc/cronjobs/holds/auto_unsuspend_holds.pl line 38.
3 - Apply patch
4 - run again
5 - It succeeds!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30939: Fix use statement for DelAuthority
Katrin Fischer [Fri, 17 Jun 2022 22:34:45 +0000 (22:34 +0000)]
Bug 30939: Fix use statement for DelAuthority

Without this patch, the script won't delete any
unused authorities, but gives an error instead
and dies:

Undefined subroutine &main::DelAuthority called at ./misc/migration_tools/remove_unused_authorities.pl line 98.

To test:
- Run from koha-shell:
  ./misc/migration_tools/remove_unused_authorities.pl -t
- Verify several authorities are reported as unused
- ./misc/migration_tools/remove_unused_authorities.pl -c
- Verify the error message is shown when the first unused
  authority is found and the script stops
- Apply patch and rerun:
  ./misc/migration_tools/remove_unused_authorities.pl -t
- Verify the error is gone, the script finishes and auhorities
  are deleted

https://bugs.koha-community.org/show_bug.cgi?id=30936

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30677: Cleanup
Martin Renvoize [Tue, 28 Jun 2022 11:29:05 +0000 (12:29 +0100)]
Bug 30677: Cleanup

This patch cleans up the regular expression to remove the superflous
double check and use standard delimiters

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30677: Use lookahead in regex for biblioitem replacement
Martin Renvoize [Wed, 11 May 2022 15:47:59 +0000 (16:47 +0100)]
Bug 30677: Use lookahead in regex for biblioitem replacement

This patch takes Andrew's suggested fix using a lookahead regex to
correct our biblio vs biblioitem table name replacements.

Please use the preceeding unit test patch proposed by Jonathan to test.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30677: Add tests
Jonathan Druart [Fri, 6 May 2022 11:53:01 +0000 (13:53 +0200)]
Bug 30677: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 23991: (follow-up) Silence useless warnings
Tomas Cohen Arazi [Mon, 27 Jun 2022 16:23:06 +0000 (13:23 -0300)]
Bug 23991: (follow-up) Silence useless warnings

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30937: Surroung Yes/No with span
Jonathan Druart [Thu, 16 Jun 2022 13:30:35 +0000 (15:30 +0200)]
Bug 30937: Surroung Yes/No with span

See bug 29602

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30937: Add a 'does not exist' hint if branchcode is invalid
Jonathan Druart [Thu, 16 Jun 2022 13:24:59 +0000 (15:24 +0200)]
Bug 30937: Add a 'does not exist' hint if branchcode is invalid

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30937: Add a detail view for libraries
Owen Leonard [Wed, 4 May 2022 17:40:27 +0000 (17:40 +0000)]
Bug 30937: Add a detail view for libraries

This patch adds a view page for libraries, so that the user isn't
required to edit the library to see information about it.

To test, apply the patch and log into Koha as a user with permission to
manage libraries.

- In the list of libraries you should see that the library name in the
  first column is now a link.
- When you click the link you should be taken to a view of all the
  information about the library.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30775: Make 952w to have datepicker plugin by default
Petro Vashchuk [Mon, 16 May 2022 14:04:18 +0000 (17:04 +0300)]
Bug 30775: Make 952w to have datepicker plugin by default

This field (Price effective from) is very similar to 952d,
but it doesn't have dateaccessioned.pl plugin by default,

Apart of worse usability of this it is also allows to enter wrong
date which will be converted in 0000-00-00 in DB and even lead to
crashes by code in other places.

So, adding this plugin not only improves usability (user can have
datepicker) but also adds date field validation.

Test plan:
1. Head over to MARC frameworks from your administration page,
check 952 subfield structure of your default framework structure.
2. dateaccessioned.pl is set as a plugin for 952d by default
but is missing from 952w.
3. Apply the patch and reset your koha, drop db and use reset_all alias.
4. Check frameworks structure again and ensure that datepicker plugin
is set by default for 952w.
5. Edit some item to ensure that datepicker works for that 952w.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 26486: Group edit buttons in reports toolbar
Owen Leonard [Wed, 23 Mar 2022 14:11:47 +0000 (14:11 +0000)]
Bug 26486: Group edit buttons in reports toolbar

This patch modifies the reports interface to change the reports toolbar
in two ways:

1. The Edit, Duplicate, and Delete buttons are now combined into a
   button menu. My original idea was to have it be a split button, but
   the logic for handling various permissions made the template logic
   too convoluted.
2. The "Show SQL code" button is converted to a "Single toggle" button
   (https://getbootstrap.com/docs/3.3/javascript/#buttons-single-toggle).
   This type of button is specifically designed for this kind of
   interface element.

This patch includes indendation changes, so please diff accordingly.

To test, apply the patch and go to Reports -> Saved reports.

- Logged in as a user with Create and Delete report
  permissions:
  - View an SQL report. In the toolbar you should see an "Edit" button
    menu with three options: Edit, Duplicate, and Delete. Check that all
    work correctly, including a deletion JavaScript confirmation dialog.

- Logged in as a user with Create but not Delete report permissions, you
  should see an "Edit" button menu with two choices: Edit and Duplicate.

- Logged in as a user with Delete but not Create report permission (??)
  you should see only a standalone delete button.

- Logged in as a user with Execute report permission, run an SQL report.
  Test the "Show SQL code" button. The text should change to "Hide SQL
  code" and the button should be styled to look like its "pressed"
  state.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 23991: (QA follow-up) Fix tabbing
Martin Renvoize [Thu, 23 Jun 2022 10:13:10 +0000 (11:13 +0100)]
Bug 23991: (QA follow-up) Fix tabbing

It looks like during one of the many rebases we lost some of the tabn
handling, likely due to the conversion from jquery-ui to bootstrap tabs.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 23991: Move SearchSuggestion to Koha::Suggestions
Jonathan Druart [Thu, 12 May 2022 09:52:45 +0000 (11:52 +0200)]
Bug 23991: Move SearchSuggestion to Koha::Suggestions

The C4::Suggestions::SearchSuggestion subroutine is badly written and
can be replaced by calls to Koha::Suggestions->search.
The hard part in this patch is suggestion.pl, the other occurrences have
been replaced easily.

Test plan:
The idea is to test the whole suggestion workflow.
1. Create a suggestion on OPAC
2. Create a suggestion on the staff interface
3. Edit suggestions
4. Filter suggestions (use the different filters and "organize by"
values)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 23991: Remove SearchSuggestion tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 23991: (QA follow-up) Save some DB queries

This patch makes the suggestion-related pages rely on array size instead
of querying the DB each time they need to. In the case of
suggestion/suggestion.pl it goes from 4 COUNT(*) to 1.

To test, with KTD:
1. Run on the host machine:
    $ docker exec -ti koha_db_1 bash
    $ mysql -ppassword
    > SET GLOBAL general_log_file='/var/log/mysql/mycustom.log';
    > SET GLOBAL log_output = 'FILE';
    > SET GLOBAL general_log = 'ON';
    > \q
    $ tail -f /var/log/mysql/mycustom.log | grep suggestions
2. Visit the different pages changed on this bug
=> SUCCESS: Some queries
3. Apply this patch
4. Repeat 2
=> SUCCESS: Less queries!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 23991: Fix branchcode and budgetid filtering

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 23991: Fix conflict with bug 28941

Well, this patchset fixed the security bug...
Redoing on top of bug 28941

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 23991: (follow-up) Missing semicolon

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 23991: Fix 'all' libraries

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 23991: (follow-up) Add value to filter_archived

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 31053: Add Context module to Koha::Encryption
Marcel de Rooy [Mon, 27 Jun 2022 08:59:30 +0000 (08:59 +0000)]
Bug 31053: Add Context module to Koha::Encryption

Test plan:
perl -MKoha::Encryption -e'print Koha::Encryption->new->encrypt_hex("test");'

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30327: DBRev 22.06.00.008
Tomas Cohen Arazi [Sat, 25 Jun 2022 18:30:47 +0000 (15:30 -0300)]
Bug 30327: DBRev 22.06.00.008

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30327: (follow-up) Fix inconsistencies in syspref names and supply defaults
Nick Clemens [Sat, 25 Jun 2022 11:18:42 +0000 (11:18 +0000)]
Bug 30327: (follow-up) Fix inconsistencies in syspref names and supply defaults

This patch fetches the new sysprefs into variables, providing default title ascending if
they are not set to avoid an undefined concatenation warning

I also make the update idempotent and fix confusion of plural/singular names

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30327: Fix tests
Nick Clemens [Fri, 17 Jun 2022 10:13:41 +0000 (10:13 +0000)]
Bug 30327: Fix tests

Corrected variable name on update to match everywhere else

Added a default value for limit in buildQuery and only append limit if it has content

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30327: Add options for sorting components
Nick Clemens [Wed, 1 Jun 2022 14:40:49 +0000 (14:40 +0000)]
Bug 30327: Add options for sorting components

This patch adds two new sysprefs:
 ComponentSortField
 ComponentSortOrder

These allow the user to choose how components should be sorted when displaying on the details page
of a record, and the corresponding search for all components

This also updates our search from simple_search_compat to search_compat to allow for sorting options

Note:
Some sorting under ES is unclear - this is a separate issue to be invesitgated
Our Zebra index does not offer 'record number' sorting, I will file a bug for that

To test:
 1 - Enable UseControlNumber (or not)
 2 - Add some components to a record by control number or title depending on above
 3 - Enable  ShowComponentRecords  syspref
 4 - View the record that has components
 5 - Note they are not sorted
 6 - Apply patch, updatedatabase
 7 - reload record
 8 - Note components are sorted by title ascending
 9 - Try different values for ComponentSortField and ComponentSortOrder
10 - Confirm sorting changes with system preferences
11 - Repeat test on staff and opac, with ES and Zebra search engines

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30994: Typo: item was on loan. couldn't be returned.
Owen Leonard [Mon, 20 Jun 2022 13:20:58 +0000 (13:20 +0000)]
Bug 30994: Typo: item was on loan. couldn't be returned.

This patch updates some language in the inventory template to make it
readable and consistent: Punctuation fixed, capitalization made more
consistent, language corrections ("check in" instead of "return").

To test you can try to apply the patch and trigger the various errors in
the inventory interface, but it's probably enough to visually confirm
the changes in the patch.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates
Alex Buckley [Wed, 22 Jun 2022 08:38:58 +0000 (08:38 +0000)]
Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates

The construct of [% ELSE %]0[% END %] breaks translations as it is
translated as [% ELSE %][% END %]. Note: No 0 in the ELSE statement.

This patchset either removes occurances of a lone 0 in template ELSE
statements, or splits it over multiple lines so the 0 is not removed in
the translated templates.

Test plan:
1. Install the en-NZ translation
2. Search the translated templates for '[% ELSE %][% END %]' and confirm
there are are instances of that
3. Apply patch
4. Update your en-NZ translation
5. Repeat step 2 and confirm there are no more instances of [% ELSE %][%
END %] in the translated templates

Note: I removed the [% ELSE %] statement from opac-bottom.inc as that
statement was empty in the en translation so it didn't look to be
needed.

Sponsored-by: Catalyst IT, New Zealand
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29282: Compiled CSS
Tomas Cohen Arazi [Sat, 25 Jun 2022 14:25:36 +0000 (11:25 -0300)]
Bug 29282: Compiled CSS

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29282: (QA follow-up) Class consistency
Martin Renvoize [Thu, 16 Jun 2022 12:15:17 +0000 (13:15 +0100)]
Bug 29282: (QA follow-up) Class consistency

This patch updates the field classes introduced in this patchset to
improve class name consistency.  We remove the _field apendment and to
repvent a clash we update the existing 'renewals' class elsewhere to
'renewals-info' to more clearly reflect it's content.

Test plan
1) The patchset should continue to function as described in prior patches
2) Build the CSS for the staff client
3) Check the 'Checkouts' table on various screens and confirm the
   renewals information still displays as it always has in the table.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29282: (follow-up) Account for otherholdings table
Lucas Gass [Fri, 13 May 2022 15:24:04 +0000 (15:24 +0000)]
Bug 29282: (follow-up) Account for otherholdings table

This patch accounts for the otherholdins table. To test:

1. Turn on SeparateHoldings
2. Find a record where the items are split by SeparateHoldings.
3. Make sure you can hide columns from the table in the Other holdings tab.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29282: Add issues and renewals columns to holdings tbale on details page
Nick Clemens [Mon, 14 Feb 2022 19:14:58 +0000 (19:14 +0000)]
Bug 29282: Add issues and renewals columns to holdings tbale on details page

To test:
 1 - Apply patch, restart all
 2 - View a record with items in the staff client
 3 - Note issues and renewals columns not shown
 4 - Click the gear to edit visible columns
 5 - Issues and renewals are present and hidden
 6 - Click to view columns
 7 - Confirm counts show, or 0 if item has not circulated/been renewed
 8 - Circulate/renew an item
 9 - Verify counts increase
10 - Make columns visible by default in Admin->Table settings
11 - Confirm columns show by default on details page

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30936: (follow-up) Add markup comments
Owen Leonard [Thu, 9 Jun 2022 18:30:10 +0000 (18:30 +0000)]
Bug 30936: (follow-up) Add 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: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30936: Reindent authority detail template
Owen Leonard [Fri, 3 Jun 2022 15:22:06 +0000 (15:22 +0000)]
Bug 30936: Reindent authority detail template

This patch updates the authority detail template so that indentation is
consistent.

To test, apply the patch and go to Authorities.

- Locate an authority record and view the detail page.
- Everything should look correct, with working numbered tabs.
- If the AuthDisplayHierarchy preference is enabled, you should see a
  collapsible tree of elements in the authority hierarchy.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30195: Remove second parameter for GetMarcFromKohaField
Jonathan Druart [Tue, 31 May 2022 07:56:09 +0000 (09:56 +0200)]
Bug 30195: Remove second parameter for GetMarcFromKohaField

It does not longer exist.

Also fix a spelling (emtpy ==> empty)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30195: Added a missing semicolon to the added subtest and increased test count...
Paul Derscheid [Thu, 12 May 2022 11:50:44 +0000 (11:50 +0000)]
Bug 30195: Added a missing semicolon to the added subtest and increased test count to 107

https://bugs.koha-community.org/show_bug.cgi?id=30195
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30195: Search by ISBN if it is provided in suggestion
Thomas Klausner [Tue, 15 Mar 2022 15:00:48 +0000 (16:00 +0100)]
Bug 30195: Search by ISBN if it is provided in suggestion

When a patron enters an ISBN/ISSN when suggesting a new purchase, the
ISBN is used to find duplicates. Title/Author are ignored (as patrons
might misspell them, and the ISBN provides a better way to find
duplicates)

Test Plan:
* in the OPAC, go to /cgi-bin/koha/opac-suggestions.pl
* Click "new purchase suggestion"
* Enter any title
* Enter an ISBN that exists in your library
* Click "Submit your suggestion"
-> A new purchase suggestion has been submitted

* Apply the patch!

* Again start a new purchase suggestion, enter any title and the
  duplicate ISBN, and Submit
* You should see the note "A similar document already exists: ..."

Please note that the title should not be required when entering an ISBN,
but as the list of required fields is managed via OPACSuggestionMandatoryFields
I fear that it's rather complicated to make title an optional required
field if isbn is provided.

I also added a simple non-DB test case to t/db_dependent/Suggestions.t
(in a subtest at the end), but could not actually run it as I haven't
gotten around to set up / try a testing Koha dev env...

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29129: DBRev 22.06.00.007
Tomas Cohen Arazi [Sat, 25 Jun 2022 14:16:23 +0000 (11:16 -0300)]
Bug 29129: DBRev 22.06.00.007

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29129: (QA follow-up) Tidy atomicupdate
Tomas Cohen Arazi [Sat, 25 Jun 2022 14:15:12 +0000 (11:15 -0300)]
Bug 29129: (QA follow-up) Tidy atomicupdate

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29129: Compiled CSS
Tomas Cohen Arazi [Sat, 25 Jun 2022 13:59:28 +0000 (10:59 -0300)]
Bug 29129: Compiled CSS

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29129: (QA follow-up) Rephrasing DisplayClearScreenButton preference
Katrin Fischer [Thu, 28 Apr 2022 16:16:04 +0000 (16:16 +0000)]
Bug 29129: (QA follow-up) Rephrasing DisplayClearScreenButton preference

Trying to make it clearer that's either none or 2 buttons.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>