koha.git
3 years agoBug 26414: Tidy the tests
Jonathan Druart [Mon, 28 Sep 2020 13:32:52 +0000 (15:32 +0200)]
Bug 26414: Tidy the tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3cd40f7bafe99c72b804dc1d6ff993fbc71f2d85)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26414: Unable to export Withdrawn status using CSV profile
Alexis Ripetti [Fri, 11 Sep 2020 20:11:55 +0000 (16:11 -0400)]
Bug 26414: Unable to export Withdrawn status using CSV profile

When using CSV profiles to export MARC records, it is impossible to export the withdrawn status. I suspect it is because withdrawn is in 952$0 and 0 is considered null rather than an actual 0.

Test Plan :
1) Go to Tools > CSV profiles
2) Click on New CSV profile
3) Enter a profile name (ex. Simple record)
4) In the Profile MARC fields field enter the following (for MARC21)
245a|100a|952o|9520
5) Save your profile
6) Go to Search and search for something
7) Add a couple of things in your cart
8) Go to your cart
9) Click on Download and choose your CSV profile
10) Open the file and notice the 9520 column contains the whole of the 952 field and not just the withdrawn status
11) Apply patch
12) Redo steps 9) and 10)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b048d155bf18d794d2ac97eaafc6f0fc00996018)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26424: Better performance of svc/checkouts
Fridolin Somers [Thu, 10 Sep 2020 13:12:39 +0000 (15:12 +0200)]
Bug 26424: Better performance of svc/checkouts

Ajax script svc/checkouts display checkouts of a patron.
For each item, it fetches a Koha::ItemType object and a Koha::AuthorisedValues object for location,ccode,lost and damaged.

For performance on huge number of checkouts :
Item types should be fetch once before the loop.
authorised values should call Koha::AuthorisedValues->get_description_by_koha_field because it uses a cache.

I've tested with Plack :
Without patch :
100 checkouts = 6 seconds
1000 checkouts = 60 seconds
With patch :
100 checkouts = 5 seconds
1000 checkouts = 44 seconds

Patch also changes the fact that authorised value categories are no longer hardcoded LOC,CCODE,LOST and DAMAGED, they depend on default framework.
Like is doing Bug 26323.

Test plan :
1) Dont apply patch
2) Use sql to define some items lost and damaged
3) Look at checkouts table on a patron with a lot of checkouts
4) Apply patch
5) Look at checkouts table again
6) Check infos are the same : record level item type, item type, location, collection, lost, damaged
7) Check infos are the same in "Number of checkouts by item type"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 340c8019d2630cc2442b51ae6dfbed5526813699)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26497: "Hide all columns" throws Javascript error on aqplan.pl
Owen Leonard [Mon, 21 Sep 2020 10:59:56 +0000 (10:59 +0000)]
Bug 26497: "Hide all columns" throws Javascript error on aqplan.pl

This patch updates the JavaScript for checking and unchecking checkboxes
on the Acquisitions planning page so that it doesn't require the
checkboxes plugin.

To test, apply the patch and go to Administration -> Budgets -> Budget
details -> Planning.

On the planning page, test the "Show all columns" and "Hide all columns"
checkboxes. They should work correctly to show and hide the correct
columns.

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit be7c705d3bfba2044d4656e86b9e94c537c26945)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26541: Remove percent sign from discount button
Andrew Fuerste-Henry [Fri, 25 Sep 2020 21:09:03 +0000 (21:09 +0000)]
Bug 26541: Remove percent sign from discount button

Realized I'd left a stray tag, fixed.

To test:
1 - go to borrower account, apply manual fee
2 - go to Transactions tab and see that fee has "% Apply discount" button
3 - apply patch, restart, reload page
4 - button just says "Apply discount"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f8d9a7a42706b3f38c373b3d0fe7baeae8a3101e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 18958: (Rmaint follow-up) Adjust number of tests
Lucas Gass [Fri, 16 Oct 2020 17:00:17 +0000 (17:00 +0000)]
Bug 18958: (Rmaint follow-up) Adjust number of tests

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 18958: DBIC shema changes
Lucas Gass [Fri, 16 Oct 2020 16:57:00 +0000 (16:57 +0000)]
Bug 18958: DBIC shema changes

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 18958: DBRev 20.05.04.002
Lucas Gass [Fri, 16 Oct 2020 16:52:04 +0000 (16:52 +0000)]
Bug 18958: DBRev 20.05.04.002

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 18958: (follow-up) Ensure hold fill target reserve_id is set for all hold types
Nick Clemens [Tue, 25 Aug 2020 10:35:02 +0000 (10:35 +0000)]
Bug 18958: (follow-up) Ensure hold fill target reserve_id is set for all hold types

MapItemsToHoldRequests has three sections: Local holds, item level holds, bib level holds

Only one of them was setting the reserve_id. This patch makes al three set it and adds tests

To test:
1 - Repeat test plan on bug
2 - sudo koha-mysql kohadev
    SELECT * FROM hold_fill_targets
3 - Ensure reserve_id is set at appropriate times
4 - prove -v  t/db_dependent/HoldsQueue.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 18958: (QA follow-up) Fix number of tests

In HoldsQueue.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b255ca7c6eec7be3027e6ade00d8477102062281)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 18958: (QA follow-up) Add missing comma to kohastructure.sql
Katrin Fischer [Sat, 22 Aug 2020 03:12:36 +0000 (03:12 +0000)]
Bug 18958: (QA follow-up) Add missing comma to kohastructure.sql

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5cfbe318d84dbaf1af8699f3e499f2c3e312a7af)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 18958: Make hold_fill_targets specific to reserves
Nick Clemens [Fri, 14 Aug 2020 11:06:40 +0000 (11:06 +0000)]
Bug 18958: Make hold_fill_targets specific to reserves

After looking at Marcel's comments, the problem is in our matching
to hold_fill_targets - rather than adjusting to find filled/waiting holds we
could ensure that hold_fill_targets only refers to the specific hold it
is intended to

This patch is clearer, if slightly less performant than last (we now return all
the reserves and have to find the 'highest')

Test Plan:
 1 - Create and use a patron that can place multiple record level holds per record
 2 - Create a record with X items, each at a different library
 3 - Place X 'Next available' holds on the record for the patron using the 'Holds to place' box
 4 - perl misc/cronjobs/holds/build_holdsqueue.pl
 5 - Check in LibraryA's copy as LibraryA and confirm the hold
 6 - Revisit request.pl for the record, notice the next hold in line is now item-specific
 7 - Checkout the item to the patron, notice the remaining hold is marked waiting
 8 - Attempt to place another hold for your patron, notice that it requires an item-specific hold
 8 - Apply this patch
 9 - Repeat steps 1-5
10 - Revisit request.pl for the record, notice the next hold in line has *not* become item-specific
11 - Checkout the item to the patron, ensure the first hold is filled and the second remains record level
12 - Repeat whole test plan without building holds queue to confirm holds are still treated correctly

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0bfe336c7b0a8993411bd45b9e7c66228730f86d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 18958: Unit tests
Nick Clemens [Mon, 12 Aug 2019 18:41:24 +0000 (18:41 +0000)]
Bug 18958: Unit tests

Signed-off-by: Bonnie Gardner <bgardner@cityoflewiston.org>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
JD amended patch: perltidy and simplify item/biblio creation

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7ee2495f321198548b3ffbf983aa1d13f6c6c2cc)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26510: Transport Cost Matrix editor doesn't show all data when HoldsQueueSkipClos...
Kyle M Hall [Tue, 22 Sep 2020 18:10:10 +0000 (14:10 -0400)]
Bug 26510: Transport Cost Matrix editor doesn't show all data when HoldsQueueSkipClosed is enabled

If HoldsQueueSkipClosed is enabled, and a library happens to be closed
on the day you edit the transport cost matrix, all the values for that
library will not show. Instead they will appear disabled, and if you
were to edit the cell and save a new value in it, it will also
'disappear' when the page is reloaded.

Test Plan:
1) Set today as a holiday for a library
2) Set HoldsQueueSkipClosed to 'open'
3) Go to the transport cost matrix editor
4) Edit a cell where the 'from' is for the closed library
5) Note the value doesn't 'save', it is still in the database though
6) Apply this patch
7) Restart all the things!
8) Reload the transport cost matrix editor
9) The value now appears correctly!

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 26ab04a3b383f5a9c88124625f8edc1c4cf1d816)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26434: Fix plugin dirs addition to @INC
Fridolin Somers [Fri, 11 Sep 2020 14:03:28 +0000 (16:03 +0200)]
Bug 26434: Fix plugin dirs addition to @INC

Plugin dirs defined in koha-conf.xml are added to @INC in order to compile perl code.
Looks like with plack those dirs are added several times.
This may lead to an error "INCLUDE_PATH exceeds 64 directories".

This bug was identified with Carrousel plugin : https://inlibro.com/instructions-carrousel/

Test plan :
1) Enable plack and plugins
2) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'
3) Install plugin KitchenSink : https://github.com/bywatersolutions/koha-plugin-kitchen-sink
4) Dont apply patch
5) Use configure on KitchenSink
6) Look at page about.pl : @INC contains server plugin dir 'var/lib/plugins'
7) Apply patch and restart plack
8) Use configure on KitchenSink
9) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dcdc72aee7d835c08ca3565a83a3dae7389a4f87)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26438: Rename temporary Koha::Item variables to avoid conflict
Colin Campbell [Fri, 11 Sep 2020 17:16:28 +0000 (18:16 +0100)]
Bug 26438: Rename temporary Koha::Item variables to avoid conflict

Returns from Koha::Item calls were stored in temporary variables
called $item. Unfortunately they occur in routines already with
an $item variable holding a lineitem and hide that variable although
only required for two lines of code. An error occurs if girfield
is called on the wrong variable. Renamed all three occurences
of $item to $kitem to avoid the error

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 647e05d8265831a09f6c624928990cfd62896b39)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26231: Remove incorrect use of AddAuthority() when 001 present
David Cook [Tue, 18 Aug 2020 02:20:32 +0000 (12:20 +1000)]
Bug 26231: Remove incorrect use of AddAuthority() when 001 present

This patch removes the use of AddAuthority with a non-empty
authid argument, since that triggers an update rather than an insert.

In practice, the update also fails, but the error isn't raised,
as the database connection doesn't have RaiseError set.

Test plan:
1) Do not apply patch
2) Try to bulkmarcimport an authority file with a 001
3) Observe that the script reports success but no authority is added
4) Apply the path
5) Try to bulkmarcimport an authority file with a 001
6) Observe that the script reports success and the authority is added

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9622561636387ced932cc31e285d13cdba607c47)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26341: Database update for bug 21443 is not idempotent and will destroy settings
Kyle M Hall [Tue, 1 Sep 2020 14:42:47 +0000 (10:42 -0400)]
Bug 26341: Database update for bug 21443 is not idempotent and will destroy settings

If the database update for bug 21443 is run, and the library changes any
of the hourly or daily rental fees following the calendar, a second run
of the database update will overwrite those changes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e708566e729239ed7857c357ee53419c44742ddd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26448: Don't overwrite commit parameter passed to koha-elasticsearch
Joonas Kylmälä [Mon, 14 Sep 2020 07:27:24 +0000 (10:27 +0300)]
Bug 26448: Don't overwrite commit parameter passed to koha-elasticsearch

The "--commit" or "-c" parameter was incorrectly not used if it was
passed to the koha-elasticsearch program.

To test:
1) Before patch notice koha-elasticsearch --rebuild --commit 1 -v <instance>
   only commits every 5000 records
2) Apply patch and notice the above command commits every 1 record

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8ede5cd3f93cb96e09f460e1ba965032e804077e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26451: fix typo in bulkmarcimport.pl
Andreas Roussos [Mon, 14 Sep 2020 08:08:23 +0000 (10:08 +0200)]
Bug 26451: fix typo in bulkmarcimport.pl

bulkmarcimport.pl displays a small typo when a MARC modification
template is being used: "modofication".

This patch fixes that.

Test plan: apply the patch, and confirm the script no longer
displays the typo.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 642c29dc230239d4ae1eb718f423c77072aa1e81)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26464: Code correction in opac-main when news_id passed
Marcel de Rooy [Tue, 15 Sep 2020 12:09:56 +0000 (12:09 +0000)]
Bug 26464: Code correction in opac-main when news_id passed

Theoretical change. If somehow the search would return more than one result, the code is wrong.

The if test can be simplified: remove scalar and >0.
We should not pass @array to one param. It would theoretically add wrong items or
trigger an odd number warning. If it is only one, it is no problem. But it is buggy.

Test plan:
Pass an existing news_id to opac-main. Item visible?
And pass a not-existing. Error message?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 22f14a7b6d45f3bf5ad57bd52203d4cdef724ce7)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 10921: Prevent an order from a closed basket to be edited
Jonathan Druart [Fri, 31 Jul 2020 09:15:57 +0000 (11:15 +0200)]
Bug 10921: Prevent an order from a closed basket to be edited

We don't allow editing of orders that are part of a closed basket, but
we don't enforce the rule in the controller file.

This patch use output_and_exit to stop the script and display an error
to the end user.

Test plan:
Create a basket, add an order
On the basket view you see the "Modify" link, open it in a separate tab
=> You can edit the basket
Keep this tab open, get back to the other one and close the basket
Reload the tab with the order edition form
=> You cannot longer edit the basket

QA: Do we need a check in addorder.pl as well?

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0310e973a4c28a7e02baad03799eb40869ce4506)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 15933: Add +x to the script
Jonathan Druart [Mon, 28 Sep 2020 08:36:40 +0000 (10:36 +0200)]
Bug 15933: Add +x to the script

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d716f2a18a7863f7b7f2e42fd8286b9982a52775)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 15933: Add cataloguing plugin to search for existing publishers in other records
Owen Leonard [Mon, 13 Jul 2020 17:42:36 +0000 (17:42 +0000)]
Bug 15933: Add cataloguing plugin to search for existing publishers in other records

This patch adds a new cataloging plugin for MARC21 installations,
marc21_field-260b.pl. When enabled it provides autocomplete for
publisher name, pulling existing data from biblioitems.publishercode.

To test, apply the patch and enable the plugin:

- Go to Administration -> MARC bibliographic framework -> MARC structure
  -> 260 -> Edit subfields -> Subfield b -> Other options.
- Set "Plugin" to marc21_field_260b.pl.
- Go to Cataloging and edit or create a record.
- Under tab 2 click the field for 260$b. Start typing a publisher name.
  A dropdown should appear with matching publishers.
- Selecting one of the results should populate the form field with that
  information.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Also works with 264$b.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f90afe5c22445fb47430f629491d09762beeb3f8)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24807: DBRev 20.05.04.001
Lucas Gass [Fri, 16 Oct 2020 14:45:45 +0000 (14:45 +0000)]
Bug 24807: DBRev 20.05.04.001

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24807: [20.05.x] Add "year" type to improve sorting behaviour
David Gustafsson [Wed, 4 Mar 2020 16:07:11 +0000 (17:07 +0100)]
Bug 24807: [20.05.x] Add "year" type to improve sorting behaviour

Add a "year" search field type. Fields with this type will only
retain values that looks like years, so invalid values such as
whitespace or word characters will not be indexed.
This for instance improves the behaviour when sorting by
"date-of-publication". If all values are indexed, records with
junk data instead of valid years will appear first among the search
results, drowning out more relevant hits. If assigning this field
the "year" type these records will instead always appear last,
regarless of sort order.

To test:

1) Have at least two biblios, one with a valid year in 008 (pos 7-10)
and another with an invalid one ("uuuu" for example)
2) Perform a wildcard search (*) and sort results by publication date.
3) The record with invalid year of pulication in 008 should appear first
4) Apply patch and run database updates
5) Reindex ElasticSearch
6) Perform the same search as in 2)
7) The record with the invalid year should now appear last

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: Add database update script

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: Update tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: Add suppport for uncertain fields and ranges

To test:
1 - Have some records with uncertain dates in the 008
    19uu, 195u, etc.
2 - Index them in Elasticsearch
3 - Do a search that will return them
4 - Sort results by publication/copyright date
5 - Note odd results
6 - Apply patch
7 - Reindex
8 - Sorting should be improved

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: Refactor using tokenize_callbacks

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: Simplify with new and imporved value_callbacks

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: (follow-up) Fix spelling

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: (follow-up) Add support for spaces as unknown characters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 24807: (QA follow-up) Remove uneccessary tests

These tests fail now, the code expects a real response from ES in Indexer.pm
but these tests mock 'bulk' and so don't have the necessary fields.

We are testing the same code above and can just add the _id == biblionumber test

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25265: [20.05.x] Prevent double reindex of the same item in batchmod
Nick Clemens [Wed, 5 Aug 2020 12:20:47 +0000 (14:20 +0200)]
Bug 25265: [20.05.x] Prevent double reindex of the same item in batchmod

When batch editing, 2 reindex calls are sent to ES/Zebra.
We can easily avoid that reusing the skip_modzebra_update (renamed skip_record_index)

Additionally we should only send one request for biblio, and we should
only do it if we succeed

As the whole batch mod is in a transaction it is possible to fail in which case
Zebra queue is reset, but ES indexes have already been set

In addition to the skip param this patchset moves Zebra and Elasticsearch calls to
Indexer modules and introduces a generic Koha::SearchEngine::Indexer so that we don't
need to check the engine when calling for index

The new index_records routine takes an array so that we can reduce the calls to
the ES server.

The index_records routine for Zebra loops over ModZebra to avoid affecting current behaviour

Test plan:

General tests, under both search engines:
  1 - Add a biblio and confirm it is searchable
  2 - Edit the biblio and confirm changes are searchable
  3 - Add an item, confirm it is searchable
  4 - Delete an item, confirm it is not searchable
  5 - Delete a biblio, confirm it is not searchable
  6 - Add an authority and confirm it is searchable
  7 - Delete an authority and confirm it is not searchable

Batch mod tests, under both search engines
  1 - Have a bib with several items, none marked 'not for loan'
  2 - Do a staff search that returns this biblio
  3 - Items show as available
  4 - Click on title to go to details page
  5 - Edit->Item in a batch
  6 - Set the not for loan status for all items
  7 - Repeat your search
  8 - Items show as not for loan
  9 - Test batch deleting items
    a - Test with a list of items, not deleting bibs
    b - Test with a list of items, deleting bibs if no items remain where all items are only item on a biblio:
     SELECT MAX(barcode) FROM items GROUP BY biblionumber HAVING COUNT(barcode) IN (1)
    c - Test with a list of items, deleting bibs if no items remain where some items are the only item on a biblio:
     SELECT MAX(barcode) FROM items GROUP BY biblionumber HAVING COUNT(barcode) IN (1,2)
 10 - Confirm records are update/deleted as appropriate

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 25265: Rename skip_modzebra_update to skip_record_index

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 25265: Fix copy paste error for parameter

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 25265: (follow-up) Don't index malformed records

This is analogous to 26522, we shoudl skip record that cannot be retrieved for indexing

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 25265: (QA follow-up) Add shebang to Indexer.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 25265: (QA follow-up) Rename biblionumber in ModZebra, index_records

ModZebra:
The name is very misleading: we can index authid's too here.
And yes, it should not be in C4/Biblio too ;) A first step..

Adding the same change here in Koha/SearchEngine/Zebra/Indexer.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 25265: (QA follow-up) Check server type in Elasticsearch::index_records

Doing the same change as previously (renaming biblionumber), but fixing
at the same the record fetch. If (theoretically) an authority is passed
without a record, it would have fetched a biblio record.

Test plan:
You need Elasticsearch here.
Replaced this line in AddAuthority:
    $indexer->index_records( $authid, "specialUpdate", "authorityserver", $record );
by
    $indexer->index_records( $authid, "specialUpdate", "authorityserver", undef );
And updated an authority record. Check if you can search for the change.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25265: [20.05.x] Unit tests
Nick Clemens [Thu, 17 Sep 2020 11:43:44 +0000 (11:43 +0000)]
Bug 25265: [20.05.x] Unit tests

These cover Koha::SearchEngine::Indexer and ensure that all calls in the code
are routed correctly to the expected search engine

Bug 25265: (follow-up) Skip tests if elastic not configured

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
3 years agoBug 26049: Replace li with span class results_summary in UNIMARC intranet XSLT
Fridolin Somers [Thu, 23 Jul 2020 08:21:36 +0000 (10:21 +0200)]
Bug 26049: Replace li with span class results_summary in UNIMARC intranet XSLT

In all XSLT for record display, fields are created with <span class="results_summary> except in UNIMARC intranet where there is just <li>.

This allows a better CSS customisation and closer code in files for OPAC and intranet.

Actually li gets diplayed with a dot at each line, we don't want this.

Test plan :
1) For each modified file run 'xsltproc file.xsl' and see there is no
   error
2) Use default XSLT in all system preferences
3) Perform a search and check display with and without patch
4) Click on a record to see details and check display with and without patch

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9db369fb58c1f2795f748e972397f1ecb882ce92)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26435: (QA follow-up) Terminology: Fix some more borrowers in other preferences
Katrin Fischer [Sat, 12 Sep 2020 17:53:26 +0000 (17:53 +0000)]
Bug 26435: (QA follow-up) Terminology: Fix some more borrowers in other preferences

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e5a959486f1ba8014b2020623cc304711bb856b7)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26435: (QA follow-up) Fix terminology: borrower to patron in new hint
Katrin Fischer [Sat, 12 Sep 2020 17:51:52 +0000 (17:51 +0000)]
Bug 26435: (QA follow-up) Fix terminology: borrower to patron in new hint

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2baad1a39d72f4cce4f4242753e6c041df410681)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26435: Add warning to AutoSelfCheck sysprefs
Andrew Fuerste-Henry [Fri, 11 Sep 2020 15:39:53 +0000 (15:39 +0000)]
Bug 26435: Add warning to AutoSelfCheck sysprefs

To test:
1- apply patch, restart
2- look up AutoSelfCheck sysprefs
3- confirm new note in description

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 38be70b55d0c01d0d9b54af0ef386d3de90161d7)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26460: Fix line ending in JSON
Nick Clemens [Mon, 14 Sep 2020 17:44:36 +0000 (17:44 +0000)]
Bug 26460: Fix line ending in JSON

Wrong line ending in JSON causes error:
Uncaught SyntaxError: missing } after property list
note: { opened at line 29579, column 15

To test:
1 - Have a title with some items not for hold in staff interface
2 - Set AllowHoldPolicyOverride to 'Allow'
3 - Attempt to place hold on the title
4 - Note JS error in the console and datatable does not load for items
5 - Apply patch
6 - Reload
7 - Error is cleared, table loads correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 692b0958414474b48ef7242b65e697913dc99deb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26420: Use translated notices for overdue_notices.pl
Jonathan Druart [Thu, 10 Sep 2020 07:42:58 +0000 (09:42 +0200)]
Bug 26420: Use translated notices for overdue_notices.pl

This script does not pass the patron's preferred lang for notices.

Test plan:
Enable TranslateNotices
Create a patron with a preferred lang for notices != default
Translate ODUE for this language
Setup the overdue notices for this patron's category
Check an item out for this patron (select the correct due date to
trigger the notice)
Run the script overdue_notices.pl
Check the message_queue table and confirm that the notice enqueued is
translated

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8e397330f687bd0e9e39387e32a8a8acbbb3b31a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26407: fix query in 'title exists' in `search_for_data_inconsistencies.pl`
Fridolin Somers [Tue, 8 Sep 2020 14:54:19 +0000 (16:54 +0200)]
Bug 26407: fix query in 'title exists' in `search_for_data_inconsistencies.pl`

Bug 23871 added check for 'title exists' to `search_for_data_inconsistencies.pl`.
There is a typo in DBIx query to create or : hashref instead of arrayref.

Test plan :
1) Change title of biblio record XXX in SQL :
   UPDATE biblio SET title = '' WHERE biblionumber=XXX
2) Change title of biblio record YYY in SQL :
   UPDATE biblio SET title = NULL WHERE biblionumber=YYY
3) Run misc/maintenance/search_for_data_inconsistencies.pl
4) Check you see both records

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 15174e7bd3f03555ff0120385443157f3da39fe2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26157: Correct two occurrences
Jonathan Druart [Wed, 9 Sep 2020 14:31:07 +0000 (16:31 +0200)]
Bug 26157: Correct two occurrences

We don't want to hide the warnings for all tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit de096ab20076b185e414dc6c0330f3370e171c49)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26548: Fix typo in updatedatabase
Lucas Gass [Mon, 28 Sep 2020 15:18:15 +0000 (15:18 +0000)]
Bug 26548: Fix typo in updatedatabase

Test plan:
1. On 20.05.x run updatedatbase and see an error
2. Apply patch
3. Re-run updatedatabase without an error

https://bugs.koha-community.org/show_bug.cgi?id=25958
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26507: [20.05.x] Elasticsearch - Index records after storing new item
Nick Clemens [Tue, 22 Sep 2020 14:14:55 +0000 (14:14 +0000)]
Bug 26507: [20.05.x] Elasticsearch - Index records after storing new item

Currently Item->store indexes the record before the DB update - that is wrong

To test:
 1 - Find/create a bib with no items
 2 - add an item with barcode "abc123"
 3 - do a general keyword search for "abc123," see your bib is not in the results
 4 - perform a search that includes your bib in the results, confirm it shows as having no items
 5 - click through to bib details, confirm it shows your item here
 6 - edit and save your item
 7 - confirm barcode is now searchable
 8 - apply patches
 9 - Add a new item "cde456"
10 - Confirm it returns in searches
11 - Edit 'cde456' and change barcode to 'fgh789'
12 - Confirm the new abrcode is searchable

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25273: (follow-up) Don't die on unknown authtype
Nick Clemens [Mon, 24 Aug 2020 14:24:39 +0000 (14:24 +0000)]
Bug 25273: (follow-up) Don't die on unknown authtype

We are guessing authtype code and inserting the heading built accorindg to C4::Heading

If we can't identify the auth type, we can format the heading. There is a record in the koha test
data that is missing the heading field so type cannot be idenfitied

This prevents us from dying n a record where we cannot identify the type.

Note: This code will also be triggered for custom authority types, higlighting
that they won't link because of hardcoded mappings in C4::Heading. We must tackle this
on a new bug

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5a87514b2e44d64807422b29f719b29b0c9d1ba4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25273: Make match-heading rely on authority type configuration
Nick Clemens [Tue, 28 Apr 2020 12:19:56 +0000 (12:19 +0000)]
Bug 25273: Make match-heading rely on authority type configuration

The match-heading field is a special field used only by the linker, not accessible
to staff or patrons via the interface. This field is used to store the constructed
'search form' used for matching bib headings to authority fields.

In bug 24269 I attempted to use the mappings defined in the inferface and also inject the search term.
This did not work as too many subfields were indexed on their own and leading to false matches.
In this bug we remove the mappings for this field, and create it ourselves during
the indexing process. The C4::Headings module is still used to generate the correct form,
however, the mappings are set based on the authority types in the system. This gives the user
the ability to add new typoes, but prevents mapping changes from breaking linker functionality

To test:
 1 - Start form a sample database with ElasticSearch working
 2 - Download via Z39.50 2 authorities, one of which is a narrower heading of the other, e.g.:
    Waterworks
    Waterworks - Costs
 3 - Place a heading for the broader term in a record. e.g. Waterworks
       In 650$a, without the cataloguing authority plugin. We don't want
       the link created now.
       You need syspref BiblioAddsAuthorities => allow
 4 - Make sure linker is set to default
 5 - Attempt to link the records
       misc/link_bibs_to_authorities.pl
 6 - Linking fails
 7 - Apply patch
 8 - refresh index settings (if using a custom file, remove 'match-heading')
       You can reset mappings in the UI or run this:
       misc/search_tools/rebuild_elasticsearch.pl -v -d -r
 9 - Reindex ES
10 - Try to link again
11 - It succeeds!
12 - Run the tests
     prove t/db_dependent/Koha/SearchEngine/Elasticsearch.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 25273: (follow-up)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ce161fda9b7d47e3cfcbc73ddb877eed627d6313)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoUpdate release notes for 20.05.04 v20.05.04
Lucas Gass [Tue, 22 Sep 2020 18:16:42 +0000 (18:16 +0000)]
Update release notes for 20.05.04

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit dcb079c353a4b0998f3c014dcb4f83a1bfb40717)

3 years agoIncrement version for 20.05.04 release
Lucas Gass [Tue, 22 Sep 2020 17:47:57 +0000 (17:47 +0000)]
Increment version for 20.05.04 release

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e3ba87e2a59c4437a4813933e162c9182b2cf805)

3 years agoTranslation updates for Koha 20.05.04
Koha translators [Tue, 22 Sep 2020 17:37:22 +0000 (14:37 -0300)]
Translation updates for Koha 20.05.04

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6750b2711e19ce0e061ac06574971e1230c69aee)

3 years agoBug 26322: Permissions not checked correctly for plugins
Tomas Cohen Arazi [Mon, 31 Aug 2020 12:43:09 +0000 (09:43 -0300)]
Bug 26322: Permissions not checked correctly for plugins

This patch fixes the logic in a condition to address the fact that
permissions are not checked for plugins. This was due to bad parenthesis
pairing and the lack of good tests for this.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t
=> FAIL: Tests fail because of bad logic
3. Apply this patch
4. Repeat (2)
=> SUCCESS: Tests pass!
5. Verify the tests cover the use cases that are needed:
   - Anonymous access
   - Real user with wrong permissions (parameters => 1)
   - Real user with right permissions (borrowers => 1)
=> SUCCESS: Needed use cases so we catch any regression are found
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 66402643d7cb95bf5ebc4832bff61becfa3d5a6a)

3 years agoBug 26322: Regression tests
Tomas Cohen Arazi [Mon, 31 Aug 2020 12:36:56 +0000 (09:36 -0300)]
Bug 26322: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit a217a8f8d6c5bf060efb67ccd369b95df78de15d)

3 years agoBug 25129: Update German (de-DE) web installer sample files for 20.05
Katrin Fischer [Sat, 23 May 2020 23:27:49 +0000 (01:27 +0200)]
Bug 25129: Update German (de-DE) web installer sample files for 20.05

This translates the new notices and CSV profie for late orders,
makes some minor changes to the patron category descriptions
and numbering patterin labelling.

To test:
- Make sure German language is installed, see:
  https://wiki.koha-community.org/wiki/Installation_of_additional_languages_for_OPAC_and_INTRANET_staff_client
- Run the web installer and choose de-DE
- Select all sample files
- Make sure they all install without any errors

Bonus:
- If you can speak German, you can check the translations as well :)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ef3b7eedc0efc726329f2f608c0f676e93fd5566)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26007: (QA follow-up) Remove message on marc_subfields_structure
Marcel de Rooy [Fri, 4 Sep 2020 09:33:13 +0000 (09:33 +0000)]
Bug 26007: (QA follow-up) Remove message on marc_subfields_structure

Why? Since the combo has been disabled since a few releases. If you
want to change this mapping, you should do it on Koha to MARC mappings.
This change is no longer per framework, but over all frameworks.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c95bb26327d11ecf8bf86dcd3996a94b2716da7c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26007: (QA follow-up) Replace wrong link values from sql installer files
Marcel de Rooy [Fri, 4 Sep 2020 09:09:00 +0000 (09:09 +0000)]
Bug 26007: (QA follow-up) Replace wrong link values from sql installer files

Field 943$a has link value "130". This does not work; 130 is not a search
index. It should be Title-uniform.
Note: Only used on a search link in the intranet MARC detail page.

In some cases "130" should be replaced by "Title-uniform", but sometimes
130 without quotes had to be replaced. Performed by two sed statements
on git grep results.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a937895fdadc9a90c53d31975ca7082516e5cdb9)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26007: (QA follow-up) Add index name to the q parameter
Marcel de Rooy [Fri, 4 Sep 2020 08:38:24 +0000 (08:38 +0000)]
Bug 26007: (QA follow-up) Add index name to the q parameter

The link constructed in MARC-detail is not consistent. It adds
an index name but does not show in the query in the search box.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 10d8f8ba93571f590fc424b927b94035dfa0b9d2)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26007: Add/fix warning for changes to the Koha to MARC mappings
Katrin Fischer [Sun, 30 Aug 2020 20:31:32 +0000 (22:31 +0200)]
Bug 26007: Add/fix warning for changes to the Koha to MARC mappings

There are 2 pages where one can change the Koha to MARC mappings in Koha:

- When editing the configuration for a MARC subfield
- On administration > Koha 2 MARC mappings

This patch adds a warning that the batchRebuildBiblioTables script
must be run if the mapping is changed.

To test:
- Go to Administration > MARC bibliographic frameworks >
  Any framework > MARC structure > Any field > Edit subfield
- ÃThe hint about the batchRebuildBiblioTables will be on "Link"
  instead of "Koha Link". This is wrong as the link doesn't care
  about the mappings.
- Go to Administration > Koha to MARC mappings
- Verify there is no hint
- Apply patch
- Verify both pages now show an appropriate message

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
This commit message is not completely accurate. See the follow-ups.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 54941f8dc558911e4222f7325609839b7c6bae81)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26388: Do not show 'Renew all' or 'Renew selected' if no renewable items
Nick Clemens [Fri, 4 Sep 2020 13:18:53 +0000 (13:18 +0000)]
Bug 26388: Do not show 'Renew all' or 'Renew selected' if no renewable items

Additionally, only include renewable items in 'Renew all'

To test:
1 - Check out some items to a patron, ideally:
    Some not renewable because set for auto renewal
    Some not renewable because of holds
    Some renewable
 2 - Confirm 'Renew selected' and 'Renew all' show on the opac
 3 - Click 'Renew all'
 4 - You get errors about the non-renewable items?
 5 - Check in all renewable items
 6 - Confirm you still see renew buttons
 7 - Apply patch
 8 - Refresh and you shoudl not see renew buttons
 9 - Check out a renewable item
10 - Click 'Renew all'
11 - Renewable item is renewed with no error
12 - Try again with 'Renew selected'
13 - Confirm it works as expected

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 763cc4eb2e53f7a44a138d6162bfa4470a484bac)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 16314: Compile CSS
Lucas Gass [Mon, 14 Sep 2020 22:11:31 +0000 (22:11 +0000)]
Bug 16314: Compile CSS

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 16314: Show upload link for upload plugin in basic MARC editor
Owen Leonard [Sat, 11 Jul 2020 13:25:11 +0000 (13:25 +0000)]
Bug 16314: Show upload link for upload plugin in basic MARC editor

This patch updates the basic MARC editor to provide a plugin name
variable to the template, allowing us to make a check on the name and
conditionally show an upload link if the "upload.pl" cataloging plugin
is selected.

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

 - Go do Administration -> MARC bibliographic framework -> MARC
   structure -> 856 -> Edit subfields.
 - Edit the "u" subfield and select "upload.pl" as the plugin under
   "Other options."
 - Go to Cataloging and create or edit a MARC record.
 - Under tab 8 look for the 856 tag, subfield u. There should be an
   "Upload" link corresponding to the form field.
 - Click the upload link to confirm that it triggers a popup window with
   the upload form.
 - Confirm that other similar plugin links (for instance 100$a, 600$a)
   display the old "tag editor" icon.

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bdb64657f9c69387f264a333a7d040c9f1dba574)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26041: Enable keyboard navigation without 'ctrl'
Martin Renvoize [Wed, 22 Jul 2020 12:28:44 +0000 (13:28 +0100)]
Bug 26041: Enable keyboard navigation without 'ctrl'

This patch enables keyboard navigation using the arrow keys without the
need to hold the control key for the jQuery UI datepicker.

Test plan
1/ Navigate to an item in the opac and attempt to place a hold
2/ On the resultant screen, use keyboard navigation to trigger the 'Show
more options' dropdown.
3/ Focus on one of the date inputs using keyboard navigation.
4/ Use 'ctrl + arrow' keys to navigate the datepicker.
5/ Note that prior to the patch using 'bare' arrow keys does not trigger
anything
6/ Apply the patch and confirm that the datepicker can now be naviated
using the arrow keys without holding the ctrl key.
7/ Confirm that using the ctrl key combinations continue to work as
expected too.
8/ Signoff

Signed-off-by: Brandon J <brandon.jimenez@inLibro.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit be92f7e79ce093e251c2489408dce3077f782c0d)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 17801: Use issuedate for limits in Most Circulated Items
Andrew Fuerste-Henry [Thu, 27 Aug 2020 18:03:14 +0000 (18:03 +0000)]
Bug 17801: Use issuedate for limits in Most Circulated Items

To test:
1 - Have two checkouts in old_issues
    issue 1: timestamp 2020-08-01 00:00:00, issuedate 2019-08-01 00:00:00
    issue 2: timestamp 2020-07-01 00:00:00, issuedate 2019-07-01 00:00:00
2 - Perform a Most Circulated Items search for checkout dates 2020-06-01 to 2020-09-01. Both checkouts appear in search
3 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Neither checkout appears in search
4 - apply patch, restart all
5 - Repeat search with checkout dates 2020-06-01 to 2020-09-01. Neither checkout appears in search
6 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Both checkouts appears in search

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 89cc457ca25e0fbaccba28b249ceedeef6573abf)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26236: Fix translating interface from DB term to readable term
Nick Clemens [Tue, 18 Aug 2020 13:33:33 +0000 (13:33 +0000)]
Bug 26236: Fix translating interface from DB term to readable term

When viewing the logs we try to swith the db values like 'cron' to friendly terms like
'Cron job'

The values we use for building the selectors on the page ar eupper case, but DB values are lower case

If we simply force upper case in the comparison we can ensure we always match correctly

To test:
1 - Enable some 'Logs' setting in System preferences
2 - Perform some action in koha that will log
    Run a cronjob
    Change a syspref
    etc.
3 - Browse to Tools-> Log viewer
4 - Click 'Submit' to see all logs
5 - Note the 'Interface' column contains lower case DB values
6 - Apply patch
7 - Reload the page
8 - Values in interface are now Camel cased and more friendly

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1733944b34499c145c2ae4c68c70efc87a5bec27)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26271: Add null to the list of accepted account_line data types
Joonas Kylmälä [Fri, 21 Aug 2020 13:23:38 +0000 (16:23 +0300)]
Bug 26271: Add null to the list of accepted account_line data types

The database schema for accountlines table allows the
manager_id/user_id column to be NULL. If request to
/api/v1/patrons/<patron_id>/account returns such an accountline where
it is NULL we get 500 error as response. Adding NULL to allowed data
types fixes this issue.

To test:
 1) Run prove t/db_dependent/api/v1/patrons_accounts.t and notice it
    doesn't fail

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 089b85758614260b70f43509ccdbc6285629a883)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26271: Add failing test to reveal issue with patrons API endpoint
Joonas Kylmälä [Fri, 21 Aug 2020 13:21:42 +0000 (16:21 +0300)]
Bug 26271: Add failing test to reveal issue with patrons API endpoint

When manager_id is null/undef the API returns error code 500.

To test:
 1) Notice failure when running
    prove t/db_dependent/api/v1/patrons_accounts.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 898cd3b82ee84682bdfad1c177e2eb6ae0881428)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26313: (follow-up) Fix OPAC and "Show volumes" links
Katrin Fischer [Tue, 1 Sep 2020 19:22:31 +0000 (21:22 +0200)]
Bug 26313: (follow-up) Fix OPAC and "Show volumes" links

Elasticsearch requires the booleans in search requests to
be uppercase. This fixes the "Show analytics" link in
OPAC (same as first patch for intranet) and the "Show volume"
link.

To test both patches:

Set UseControlNumber = Use

1) "Show analytics"
- Turn SearchEngine to Elasticsearch and make sure it works
- Pick any serial record in your database, make sure 001 is set
- Go to new > new child record
- Fill in 245 and save
- For both staff and OPAC:
  - Click on the "In" link, it should bring you to the parent record
  - Click on "Show analytics", it should show your analytical record
- Switch to "Zebra" - verify links still work.

2) "Show volumes"
- Turn SearchEngine to Elasticsearch again
- Pick any serial record in your database, make sure 001 is set
- Set LDR, pos. 19 = a - Set
- Note 001 value
- Find another record and edit it
- Set LDR, pos. 19 = a or b, LDR 7 not a or b (m will work)
- Set 773$ title of set record $w 001 of set record
- For both staff and OPAC:
  - Click on the "In: link, it should bring up your set record
  - Click on the "Show volumes" link, it should bring up the volume

- Switch to "Zebra" - verify all links still work.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8a37842e1af3fdc9e5e4eb2eb6ec9190ed31915e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26313: "Show analytics" link must use uppercase for booleans
Nick Clemens [Tue, 1 Sep 2020 12:32:56 +0000 (12:32 +0000)]
Bug 26313: "Show analytics" link must use uppercase for booleans

In elasticsearch we only treat AND and OR as boolean operators if
they are capitalized

To test:
- Turn SearchEngine to Elasticsearch and make sure it works
- Pick any serial record in your database, make sure 001 is set
- Go to new > new child record
- Fill in 245 and save
- Click on the "In" link, it should bring you to the parent record
- Click on "Show analytics" => there will be no result
- Apply patch
- restart and reload
- Try again
- It works!
- Switch SearchEngine syspref to 'Zebra'
- Test again
- It still works!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fde7bf5495dedf681acb3193891de44eec4d2bfa)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26331: Make svc/letters/preview executable
David Cook [Tue, 1 Sep 2020 05:19:14 +0000 (15:19 +1000)]
Bug 26331: Make svc/letters/preview executable

Without this patch, you can't preview letters when running Koha in CGI mode.

To test:
1. Run Koha as CGI (and not Plack)
2. Go to /cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=&module=circulation&code=CHECKIN
3. Try to preview the notice (using a valid barcode)
4. Note in the browser console that svc/letters/preview is generating a 500 error

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c53dfb5562a12c1a8d8b9d3d0c28cb17d001edb5)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26362: Show correct libraries in overdues report
David Cook [Thu, 3 Sep 2020 05:40:57 +0000 (05:40 +0000)]
Bug 26362: Show correct libraries in overdues report

Currently the overdues report does the following display:
Patron library = home branch
Home library = holding branch
Holding library = patron branch

This patch corrects the display of libraries in the overdues report.

To test:

0) Do not apply patch
1) Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
2) Go to http://localhost:8081/cgi-bin/koha/circ/set-library.pl
3) Choose "Troy"
4) http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
5) Checkout "39999000004571" with due date of "09/01/2019 23:59"

Note the facts:
Patron library = Centerville
Home library = Fairview
Holding library = Troy

6) Go to http://localhost:8081/cgi-bin/koha/circ/overdue.pl
7) Change "Columns" visibility to show Holding and Home libraries
8) Note that the libraries are incorrect:

Patron library appears to be: Fairview
Home library appears to be: Troy
Holding library appears to be: Centerville

9) Apply the patch
10) koha-plack --restart kohadev
11) Go to http://localhost:8081/cgi-bin/koha/circ/overdue.pl
12) Change "Columns" visibility to show Holding and Home libraries
13) Note that the libraries are correct:

Patron library appears to be: Centerville
Home library appears to be: Fairview
Holding library appears to be: Troy

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b729886216560fdf50d88dc8214c0dbb58720b5c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26309: Make cxn_pool configurable
Nick Clemens [Thu, 27 Aug 2020 15:03:17 +0000 (15:03 +0000)]
Bug 26309: Make cxn_pool configurable

In get_elasticsearch_params we set the conf to static if undefined,
but we never defined it

To test:
1 - Apply unit test patch
2 - prove -v t/Koha/SearchEngine/Elasticsearch.t
3 - It fails
4 - Apply this patch
5 - It succeeds

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b87dc492fe4ea009ad3c72aca43add0515d6da1c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26309: Unit tests
Nick Clemens [Thu, 27 Aug 2020 15:03:07 +0000 (15:03 +0000)]
Bug 26309: Unit tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2e421ed7a4e9bd3336b8e2b1eb9200c8c6342462)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25448: Update German (de-DE) framework files
Katrin Fischer [Sat, 23 May 2020 15:19:37 +0000 (15:19 +0000)]
Bug 25448: Update German (de-DE) framework files

The updated files have been auto-generated based on the
po files and downloaded from
https://translate.koha-community.org/files/

To test:
- Make sure German language is installed, see:
  https://wiki.koha-community.org/wiki/Installation_of_additional_languages_for_OPAC_and_INTRANET_staff_client
- Run the web installer and choose de-DE
- Select all sample files
- Make sure they all install without any errors

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c0adeab58feaa7fb0b5c97e55b8356bb916aa163)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24147: Don't assume search_related will return ordered values
Jonathan Druart [Thu, 20 Aug 2020 12:32:43 +0000 (14:32 +0200)]
Bug 24147: Don't assume search_related will return ordered values

This test is failing randomly because it assume the order is always the
same. But it's not.

Note: Koha::Objects->search_related is never used , last use removed from
  commit 9aa724cdf29a57bc91e42b240b5bcd19e3814ada
  Bug 19599: Speed anonymise_issue_history up
We should keep it however IMO

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e10dc503289e8d7e8c742af0111acb79d4d53111)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25584: Fix minor styling issue
Tomas Cohen Arazi [Thu, 27 Aug 2020 18:10:08 +0000 (15:10 -0300)]
Bug 25584: Fix minor styling issue

This patch makes the button present some space between the icon and the
text.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2a0ccf7af26236db9a3e40968cf8f43bc308f142)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25584: Refresh checkouts table when a return claim is added
Tomas Cohen Arazi [Thu, 27 Aug 2020 17:57:45 +0000 (14:57 -0300)]
Bug 25584: Refresh checkouts table when a return claim is added

This patch triggers a checkouts table refresh when a return claim is
added. I also noticed the same when a return claim is deleted so it is
now also refreshed.

To test:
1. Set the ClaimReturnedLostValue to some valid value (2)
2. Check something out for a patron, and choose to display all checkouts
=> SUCCES: There's the checkouts table, showing the checkout
3. Click on the 'Claim returned' button and confirm
=> SUCCESS: There's no 'Claim returned' button anymore
=> ERROR: The checkout row doesn't display anything about the claim
4. Go to the 'Claims' tab, delete resolve and delete the claim
5. Go to the Checkouts tab
=> ERROR: It doesn't reflect the changes either
6. Apply this patch and start over
=> SUCCESS: Once the claim returned is added, the checkouts table is
refreshed and the information updated
=> SUCCESS: On the Claims tab, if you delete the claim and go to the
Checkouts tab, you are presented the button again.
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7fc7427dd41ce10070a6a3d3070fb660850be511)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26324: Fix spelling resizable vs resizeable in Dopop
Jonathan Druart [Mon, 31 Aug 2020 12:26:26 +0000 (14:26 +0200)]
Bug 26324: Fix spelling resizable vs resizeable in Dopop

The correct spelling of the parameter is resizable
https://developer.mozilla.org/fr/docs/Web/API/Window/open

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ce7f4d16d6acdc6a56d40e6ebd96d722f1c77387)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26069: Pass correct URL to twitter
Jonathan Druart [Fri, 21 Aug 2020 14:07:46 +0000 (16:07 +0200)]
Bug 26069: Pass correct URL to twitter

We don't provide the url of the detail page so the twitter JS code
retrieve the current location, with the search terms.

Test plan:
Do a search
Click on a result
Click on the twitter button and confirm that the link only contain
biblionumber=x in the parameter

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5fd8774c687c6aaf6716485ab9bd72a69a0e2f76)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 17661: Trivial simplification using += operator
Jonathan Druart [Mon, 31 Aug 2020 13:25:05 +0000 (15:25 +0200)]
Bug 17661: Trivial simplification using += operator

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c96fabb8c47320dba55372e4b955fb171310adec)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 17661: (follow-up) Update regex to support Unicode characters
Nick Clemens [Thu, 27 Aug 2020 16:27:09 +0000 (16:27 +0000)]
Bug 17661: (follow-up) Update regex to support Unicode characters

Rather than limiting initials to [A-Z] we should test for a broad
range of uppercase letters.

The ES/Zebra changes are slightly different because of Perl vs Java regex
conventions. POerl may support either, but I found 'Uppercase' to be a bit more explicit

More info here:
https://perldoc.perl.org/perlunicode.html

TO test:
Same plan as before but use Ж. as the ending initial
Confirm the period is preserved and other punctuation removed

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 224ac84aeca3b8dba87366925d83b01e0f5c1110)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 17661: Ending punctuation causes duplicate facets
Nick Clemens [Thu, 2 Nov 2017 16:52:53 +0000 (16:52 +0000)]
Bug 17661: Ending punctuation causes duplicate facets

The current code for facets doesn't pull strip ending punctuation from facets
This causes duplicate facets for terms that should be combined

Sometimes series can have different punctuation depending on the field they are in
Author initials punctuation should be preserved

To test:
1 - Do search and pull up some records
2 - Edit some of the records to have authors like:
    Date, C.J.
    Date, C.j.
    Date, C.J .
3 - Edit the records to have some series statments like:
    830 $aDate, C.J. ;$v5
    830 $aDate, C.J. ; $v5
    830 $aDate, C.J.; $v5
4 - Add some 490s to the record with first indicator 1 and series like:
    You wouldn't want to--
    You wouldn't want to
    You wouldn't want to..
5 - Search again and note you have 3 facets each for author and series
6 - Apply patch
7 - Repeat
8 - Now you get 2 facets for author, period not removed when following Upper case immediately, is otherwise
9 - Now you should have a single series facet
10 - Switch search engine to ES (index before applying patch)
11 - Note facets are separate again
12 - Reset mappings and reindex
   perl misc/search_tools/rebuild_elasticsearch -v -r
13 - Repeat search, facets combined as above

Signed-off-by: Sarah Cornell <sbcornell@cityofportsmouth.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e34f95a1f5eb0fce238ab442553bec5233263a9c)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoRevert "Bug 26289: Add missing variable definition to templates"
Lucas Gass [Fri, 4 Sep 2020 20:42:21 +0000 (20:42 +0000)]
Revert "Bug 26289: Add missing variable definition to templates"

This reverts commit 8ff281cca587a612628014a45d0211b7295849f8.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26289: Add missing variable definition to templates
Owen Leonard [Tue, 25 Aug 2020 19:30:00 +0000 (19:30 +0000)]
Bug 26289: Add missing variable definition to templates

This patch puts definition of the missing "searchid" variable into an
include file to be used by various bibliographic detail pages. The
variable is required by several JavaScript functions.

To test, apply the patch and locate or create a record with no items.
Open the labeled MARC view and choose Edit -> Delete record. Confirm the
deletion. The deletion should complete correctly.

Perform the same test with the detail view, ISBD view,  MARC view, and
items view.

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a4e922ffe8a5ea760f2401aca44b1dd9be97c7ec)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25639: Add search query strings as global javascript variables
Nick Clemens [Wed, 29 Jul 2020 10:56:37 +0000 (10:56 +0000)]
Bug 25639: Add search query strings as global javascript variables

To test:
1 - Search on OPAC for "qwertyuiop"
2 - View the HTML source
3 - Find 'qwertyuiop' in the source, it is not easily accessible via JS
4 - Apply patch
5 - Repeat
6 - Note that now there are global variables with the query strings
7 - Add to OpacUserJs:
    console.log( query_desc );
    console.log( querystring );
    console.log( query_cgi );
8 - Reload page and confirm variables are warned in the JS console (Press F12)
9 - Sign off

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit cf93255428125241745faaaec0a0b1f8455c7526)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26013: Fix formatting for dates on "Manage stage MARC records" page
Katrin Fischer [Fri, 17 Jul 2020 22:03:28 +0000 (22:03 +0000)]
Bug 26013: Fix formatting for dates on "Manage stage MARC records" page

The "staged" dates were not formatted according to system
preferences DateFormat and TimeFormat as the appropriate TT
filters were missing.

To test:
- Stage a record in MARC format
- Go to Staged MARC management
- Check the date in the list of imports
- Click on the import and check the "Staged:" date
- Apply patch
- Repeat and verify formatting is now correct

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9e97dbca2983163e1ffc19fc435ac8bea6550c82)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26175: Remove warn if undefined barcode in misc/export_records.pl
Fridolin Somers [Fri, 7 Aug 2020 08:58:51 +0000 (10:58 +0200)]
Bug 26175: Remove warn if undefined barcode in misc/export_records.pl

When using misc/export_records.pl --deleted_barcodes if barcode is NULL you get warn :
Use of uninitialized value in say at /home/koha/src/misc/export_records.pl

Also exporting barcode if empty string makes no sense.

Test plan :
1) Delete an item with barcode = NULL
2) Run : misc/export_records.pl --date=`date +%d/%m/%Y` --deleted_barcodes --filename=/tmp/deleted_barcodes
3) Check you se no warn "Use of uninitialized value in say ..."
4) Delete an item with barcode = ''
5) Run 2)
6) Check there is no empty line in /tmp/deleted_barcodes

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4d9ab04a9391a4960a6155d983fdf839467bfdf4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25662: (follow-up) Add tests for the wrong patron_id added behaviour
Tomas Cohen Arazi [Tue, 23 Jun 2020 13:35:54 +0000 (10:35 -0300)]
Bug 25662: (follow-up) Add tests for the wrong patron_id added behaviour

This patch adds trivial tests for the new error (400) raised when the
passed patron_id doesn't exist.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
2. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit deee485a24df0734cace673dc519f15d41a5b575)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25662: Make the route for holds restpect maxreserves
Tomas Cohen Arazi [Tue, 23 Jun 2020 13:33:14 +0000 (10:33 -0300)]
Bug 25662: Make the route for holds restpect maxreserves

This patch fixes the behaviour for the POST /holds route. It assumed
maxreserves was checked in CanItemBeReserved which is not the case.

Tests are added to check for this behaviour.

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 69bdc94cd4f420094c5706fb2bfc472ba24a5054)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25662: Regression tests
Tomas Cohen Arazi [Tue, 23 Jun 2020 13:11:58 +0000 (10:11 -0300)]
Bug 25662: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9a63cf6dec55c67491e5a2807fe74f9083167ccc)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25958: DB Rev 20.05.03.001
Lucas Gass [Fri, 4 Sep 2020 19:59:42 +0000 (19:59 +0000)]
Bug 25958: DB Rev 20.05.03.001

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25958: (QA follow-up) Implement filter in database query instead of in loop
Kyle M Hall [Mon, 24 Aug 2020 17:13:17 +0000 (13:13 -0400)]
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 66382458dc46356818473935e8d5546f13f05645)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25958: (QA follow-up) Add some punctuation to new DefaultLongOverdueSkipLostStatuses
Katrin Fischer [Sat, 22 Aug 2020 02:41:20 +0000 (02:41 +0000)]
Bug 25958: (QA follow-up) Add some punctuation to new DefaultLongOverdueSkipLostStatuses

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d99651efd0a9a827b91f4575ab6f1d4344c7cfb0)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25958: Allow LongOverdue cron to exclude specified lost values
Kyle M Hall [Tue, 28 Jul 2020 11:55:18 +0000 (07:55 -0400)]
Bug 25958: Allow LongOverdue cron to exclude specified lost values

When lost items are not marked as returned, they are still subject to
the long overdue cron, so an item that has already been marked Lost may
automatically roll to Long Overdue. In some cases, a library may not
want that lost value to change. This becomes especially important with
the introduction of Claims Returned, which uses a variety of lost.

Test Plan:
1) Set up a long overdue item that would be moved to lost by longoverdue.pl
2) Run the cronjob with the new --skip-lost-value option
3) Note the item is not altered
4) Include that value in the new system preference DefaultLongOverdueSkipLostStatuses
5) Run the cronjob *without* the new option
6) Note the item is not altered
7) Run the cronjob again with the new command line option, but set it to
a different value so the item will be affected
8) Note the item is altered as it would have been before this patch was
applied

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 48edb2947163c1e9a70b11de40a71ebed747952f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26150: Remove the use of jquery.checkboxes plugin from inventory page
Owen Leonard [Wed, 5 Aug 2020 17:00:26 +0000 (17:00 +0000)]
Bug 26150: Remove the use of jquery.checkboxes plugin from inventory page

This patch removes the use of the jquery.checkboxes plugin from the
inventory page and replaces it with custom JS.

To test, apply the patch and go to Tools -> Inventory.

 - Submit the form with some selections which will return results on the
   following page. I filtered by library.
 - On the page showing results, test that the "Select all" and "Clear
   all" links work correctly.

Signed-off-by: Brandon J <brandon.jimenez@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9655029bca97ab5f159f03acadf6601b5edbc421)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 21539: addorderiso2709.pl forces librarian to select a ccode and notforloan code...
Kyle M Hall [Wed, 10 Oct 2018 15:13:37 +0000 (11:13 -0400)]
Bug 21539: addorderiso2709.pl forces librarian to select a ccode and notforloan code when using MarcItemFieldsToOrder

There is no reason that MarcItemFieldsToOrder should force librarians
to select a ccode and notforloan value for each item.
They are both optional fields.
As with location, the first value should be an empty 'none' option.

Test Plan:
1) Set up MarcItemFieldsToOrder, do *not* set mappings for ccode and notforloan
2) Add an order record to a basket that uses MarcItemFieldsToOrder
3) Note you must choose a ccode and nfl value
4) Apply this patch
5) Reload the page
6) Note you no longer have to select values for ccode and notforloan

Signed-off-by: Daniel Gaghan <daniel.gaghan@pueblolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0c79b7d93b96434ddf91c6ddabb1570836736a15)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26189: Compile CSS
Lucas Gass [Fri, 4 Sep 2020 19:34:01 +0000 (19:34 +0000)]
Bug 26189: Compile CSS

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26189: Improve styling of datatables within fieldsets
Martin Renvoize [Wed, 12 Aug 2020 12:58:58 +0000 (13:58 +0100)]
Bug 26189: Improve styling of datatables within fieldsets

Unset label width restriction: The label width restriction within
fieldsets causes issues for the datatables header. Unsetting it
explicitly here resolves the line wrapping issues :)

Reset margins for datatables found inside fieldsets such that the
datatable properly utilises the available space and restore the
default datatable label font weights.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b65efd3f224342be8e751e54f7ada8fc482755bb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25791: Remove win.print()
Lucas Gass [Wed, 15 Jul 2020 22:28:07 +0000 (22:28 +0000)]
Bug 25791: Remove win.print()

Test plan:
1) Turn on system preference SelfCheckReceiptPrompt
2) Check out item via /cgi-bin/koha/sco/sco-main.pl
3) Click "Finish"
4) Click 'Print receipt and end session'
5) Notice two print dialog boxes right on top of each other
6) Apply patch
7) Repeat steps 1 - 4
8) Should only get a single print dialog.
9) Test in FF/Chrome and make sure behavior is consistent

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6797f07bbdfb90c556f52bfe2f83cefdf91495f3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25903: Add unit tests
Kyle M Hall [Thu, 20 Aug 2020 11:56:12 +0000 (07:56 -0400)]
Bug 25903: Add unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 49f5200374e9a381ab7398730e42c0beefc0f2a4)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 25903: Sending a SIP patron information request with a summary field flag in...
Kyle M Hall [Tue, 30 Jun 2020 18:37:21 +0000 (14:37 -0400)]
Bug 25903: Sending a SIP patron information request with a summary field flag in indexes 6-9 will crash server

The 'summary' field in the patron information request specifies if detail information should be send for holds,
overdues, fines, etc. The field is 10 characters in length (0-9). However, the SIP2 spec only defines indexes 0
though 5, leave 6 though 9 undefined. Some ILSs specify behavior for these undefined indexes. Apparently the
7th field is often used to request 'Fees', as opposed to 'Fines' in some ILS. Some software that integrate via
SIP try both the 5th and 7th indexes to ensure they get all fines and fees.

The problem is that Koha's SIP server crashes if any 'summary' index beyond 5 is flagged. We should simply
ignore flags beyond 5 and act as if no flags were sent.

Test Plan:
1) Enable SIP for your instance
2) Send a patron information request with a summary flag in any index beyond 5.
   i.e.: 6300120200617    124846      Y   AOMIDAY|AA21030050054321
3) Note the SIP server just closes the connection without a response
4) Apply this patch
5) Restart the SIP server
6) Send the same request
7) Note you get back the patron information response!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jeff Gaines <jgaine@arlingtonva.us>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fd4dbba7fb25bb73bcee152c84e704f9796664fd)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26076: (QA Follow up) Prevent error by using a fresh resultset
Kyle M Hall [Thu, 30 Jul 2020 13:35:38 +0000 (09:35 -0400)]
Bug 26076: (QA Follow up) Prevent error by using a fresh resultset

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c9887a87538b2113c48db8cd2751a4bcf2bd2168)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26076: Sum the amount due in the database query instead of a loop in Perl
Kyle M Hall [Tue, 28 Jul 2020 16:49:35 +0000 (12:49 -0400)]
Bug 26076: Sum the amount due in the database query instead of a loop in Perl

This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Verify that "Write off selected" functions as usual

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 64412969037ac9a9f81f05c69c3dd43bd3cab90b)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24683: IsAvailableForItemLevelRequest sub description expanded
Andrew Nugged [Sun, 19 Jul 2020 21:16:51 +0000 (00:16 +0300)]
Bug 24683: IsAvailableForItemLevelRequest sub description expanded

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d19e76000f02533302d8093e051cf3a0034d1e27)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24683: whole test formatted by 'perltidy'
Andrew Nugged [Sun, 19 Jul 2020 21:15:37 +0000 (00:15 +0300)]
Bug 24683: whole test formatted by 'perltidy'

This is complementary patch using styling from
bundled /xt/perltidyrc file

Almost no code change except a few long constant strings
broken to parts by concatenation.

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3c4f475d1a4e64e8e437e9b4906af9cba6c0756f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24683: Fix for take smart rules into account in "if all unavailable"
Andrew Nugged [Sun, 19 Jul 2020 21:20:56 +0000 (00:20 +0300)]
Bug 24683: Fix for take smart rules into account in "if all unavailable"

Inside of ItemsAnyAvailableAndNotRestricted was no effect from main set
of smart rules (per record and other limits): i.e. call to
"CanItemBeReserved" was absent totally.

Because of this there was a bug: for example none of two items were
allowed to be held when first was allowed by one smart rule, BUT on loan,
and second was disallowed by another smart rule (for example,
0 "Holds per record"),

i.e. in this case both items unavailable: so on-shelf holds setting
"allow hold if all unavailable" should allow to hold first one, and not
the second one. But it was that both wasn't allowed to be held.

Solution: call to sub "CanItemBeReserved" added so it checked for
"...->{status} ne 'OK'" so now if item restricted by smart rule it also
accounted as "unavailable" and "AnyAvailavble" not counts it.

How to reproduce:

1. Add 2 smart rules (/cgi-bin/koha/admin/smart-rules.pl) with "on shelf
   holds": "if all unavailable" for all rules, no "item level holds", and
   set "holds per record" to 2 for "books" and "0" for "computer files".

2. Create only 2 items for one biblio, but different types, "book"
   and "computer file". For example in misc4dev env:
   /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additem

3. Check out that item of type "book" to some person, for example,
   in misc4dev:
   /cgi-bin/koha/circ/circulation.pl?borrowernumber=2&barcode=3999900000001

4. Open reserve/request, for example, for item 1 and patron 1 in misc4dev
   env (/cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1)

5. It does not allow to hold, both red crossed, but computer file says
   "Exceeded max holds per record" because of "0" limit set on step 1.

6. Apply the patch.

7. Reload page on step 5 and see that "book" will be available for hold,
   but "computer file" still will be red-crossed "Exceeded max holds
   per record", now that's correct because both items unavailable:
   one because on load, another because of "0" limit for computer files.

8. Check-in book from step 3 so it will be returned to the library,

9. Reload page on step 5 and see that again no any holds available,
   but it's now also correct: "book" now returned but "on shelf holds"
   set to "if all unavailable".

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4599fcc59d4036cb5e3d776b9f162062968e8d98)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted
Andrew Nugged [Fri, 17 Jul 2020 11:59:19 +0000 (14:59 +0300)]
Bug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted

Add cut-off shortcut (return from inside the loop) when first
"Any Available And Not Restricted" item found, because one is
enough for "Any".

Testing: no change visible for code behavior/results,
it is just faster because won't loop over the whole set.

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 720b69780c1f62c61f4b36df02d46d8c85c0d30a)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 24683: Subroutine name changed (fix), no code logic changed This is the intermedi...
Andrew Nugged [Fri, 5 Jun 2020 06:59:48 +0000 (09:59 +0300)]
Bug 24683: Subroutine name changed (fix), no code logic changed This is the intermediate refactor: renamed subroutine only.

Naming mistake came because this sub is used to detect if anything
available for hold, but it used in "if ANY UNAVAILABLE rule", so actually
results of this sub negated (see below "return" in the code).

In details:

when previous refactor was done, name for subroutine was chosen
wrongly in "opposite" direction from what it actually does:

it was named "ItemsAnyAvailableForHold", but this subroutine gave
truth (1) if at least one of the items available on shelf, not lost,
not on loan, not held, and not restricted by smart rules and damaged
status. So, if this sub says that item is still "available", this
actually PREVENTS item from hold in parent sub (see negated return):

    sub IsAvailableForItemLevelRequest {
        ...
        my $any_available = ItemsAnyAvailableAndNotRestricted...
        return $any_available ? 0 : 1;
             # ^^^ if any available and not restricted - we don't allow
             #     on-shelf holds
        ...

I.e. like it named now: "ItemsAnyAvailableAndNotRestricted".

Small aside fix: white space for '&&' inside brackets added to join
operation by priority visually.

Testing plan not needed: all places where sub used it just renamed.
More: all this places/code was introduced in one older commit so there
is also no overlaps or other calls/uses for this subroutine.

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 618cf80df9b0b668174b28ff61cad8a938704ec3)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26023: Properly secure the cashup and refund actions
Martin Renvoize [Tue, 4 Aug 2020 14:02:03 +0000 (15:02 +0100)]
Bug 26023: Properly secure the cashup and refund actions

The cash register summary page for cash management is available for users
with the 'anonymous_refund' or 'cashup' permission and the actions available
are appropriately displayed.

However, the actions are not yet correctly tested for at the server and
so a user may force submit to accomplish the action.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e0420165694c790f2346fb598862e4aacfdf0fcc)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
3 years agoBug 26023: Properly secure the cashup action for libraries
Martin Renvoize [Mon, 20 Jul 2020 08:44:05 +0000 (09:44 +0100)]
Bug 26023: Properly secure the cashup action for libraries

The libraries summary page for cash management is available for users
wit the 'anonymous_refund' permission to allow them to navigate to
alternate cash registers and search for the prior transaction to refund.

However, currently the cashup option appears, and is not blocked at the
server, for all user who may access the page. It should be blocked for
those users without the 'cashup' permission.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4356e678f2254707c48a6f89658ed089a6b9e662)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>