koha.git
3 years agoBug 26010: Remove the use of jquery.checkboxes plugin from staff interface cart
Owen Leonard [Fri, 17 Jul 2020 17:29:15 +0000]
Bug 26010: Remove the use of jquery.checkboxes plugin from staff interface cart

This patch removes the use of the jquery.checkboxes plugin from the
staff interface cart and replaces its functionality with "plain" jQuery.

To test, apply the patch and add some items to the Cart in the staff
interface.

- Open the Cart window in the staff interface by clicking the "Cart"
  link in the header.
- Test that the "Select all" and "Clear all" links work correctly to
  check and uncheck all checkboxes.
- Test that the "Remove" or "Place hold" controls work correctly,
  applying to only the checked checkboxes whether they were checked
  using "Select all" or by manually checking them.

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>

3 years agoBug 26087: Add table configuration and export options to orders by fund report
Owen Leonard [Wed, 29 Jul 2020 13:49:16 +0000]
Bug 26087: Add table configuration and export options to orders by fund report

This patch adds column configuration to the orders by funds report
results table. The "Basket" column is excluded from being togglable.

To test, apply the patch and clear your browser cache if necessary.

- Go to Reports -> Orders by fund
- Submit parameters which will return multiple results.
- Test that the "Column visibility" button works to show and hide
  columns. The "Basket" column should be excluded.
- Test the export options (Excel, CSV, etc)
- Go to Administration -> Columns settings and edit the default
  configuration of the orders by fund report. Confirm that these changes
  are reflected in the report results.

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>

3 years agoBug 26091: Add column configuration and export options to catalog statistics report
Owen Leonard [Wed, 29 Jul 2020 16:21:10 +0000]
Bug 26091: Add column configuration and export options to catalog statistics report

This patch makes the catalog statistics report output a DataTable with
on-the-fly column configuration and export options.

Because the report can generate results with an arbitrary set of table
headers, the columns set to be passed to DataTables is built on the fly
along with the table. There is no global table setting.

Since the "grand total" cell might reflect a total which includes hidden
columns, the table footer label now indicates "all results."

To test, apply the patch and go to Reports.

- Submit a query to the "catalog" statistics wizard which will return
  multiple results.
- On the results page, confirm that the DataTable displays correctly and
  that all controls work as expected, including column configuration and
  export options.
- Submit other queries which will return a different set of columns in
  the result. Confirm that everything continues to work as expected.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Bug 26091: (follow-up) Remove unused TablesSettings usage

Since the table column information is built in the template rather than
in the columns_settings YML file we don't need "USE TablesSettings" in
this template.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26160: Make POS items table configurable
Martin Renvoize [Thu, 6 Aug 2020 13:33:32 +0000]
Bug 26160: Make POS items table configurable

1)  System preference:  EnablePointOfSale - set to Enable
2)  System preference:  UseCashRegisters - set to Use
3)  Administration > Accounting > Cash registers - create a new cash register for the library you're logged in as
4)  Administration > Accounting > Debit types - create at least one debit type
5)  Home > Point of sale - verify that all four columns exist in the Items for purchase table:  Code, Description, Cost, Action
6)  Administration > Additional parameters > Table settings > Point of sale - change which columns can be hidden and/or toggled
7)  Home > Point of sale - verify that your choices have been implemented (columns are hidden, columns can be toggled, columns can't be toggled)
8) Repeat steps 6 and 7 for different combinations, checking that they all work.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Added Sally's test plan.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26161: Move actions under rhs fieldsets
Martin Renvoize [Thu, 6 Aug 2020 14:22:07 +0000]
Bug 26161: Move actions under rhs fieldsets

This patch moves the action buttons div to within the column div that
contains the 'This sale' and 'Collect payment' fieldsets.

Test plan
1/ Apply patch
2/ Navigate to the 'Point of sale' page (having enabled UseCashRegisters
and EnablePointOfSale)
3/ Confirm the 'Confirm' and 'Cancel' button/link now appear on the
correct side.
4/ Signoff

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>

3 years agoBug 26179: Remove redundant import of Google font
Timothy Alexis Vass [Fri, 7 Aug 2020 12:59:16 +0000]
Bug 26179: Remove redundant import of Google font

Removed redundant @import of google font

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>

3 years agoBug 26012: Correctly format "paid for" info on the item details view
Jonathan Druart [Wed, 29 Jul 2020 14:49:14 +0000]
Bug 26012: Correctly format "paid for" info on the item details view

The string is built controller side, which does not let the template
format the info nicely.
We want to display patron's info using patron-title.inc and the date
with the KohaDates plugin

Test plan:
- Make sure there is a replacement cost in the item
- check it out
- Mark it lost
- Pay the lost item fee
- Go to the detail page and look on the items tab for the item
- It will show an entry with "Paid for?" label
The patron's info and date must be correctly formatted

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26165: Fix duplication of large saved reports
Jonathan Druart [Fri, 7 Aug 2020 10:44:28 +0000]
Bug 26165: Fix duplication of large saved reports

If the combined character length of a saved report's
title, notes and SQL is too long then pressing the
'duplicate' button will lead to an error:

"Request-URI Too Long
The requested URL's length exceeds the capacity limit
for this server."

Test plan:
1. Create a simple SQL report and add a lot of text
   into the notes field (the combined URL lenth must be
   >8225 characters)
2. Save the report
3. Press the duplicate the report from the saved reports page

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>

3 years agoBug 23542: Fix SRU import encoding
Fridolin Somers [Mon, 29 Jun 2020 13:07:10 +0000]
Bug 23542: Fix SRU import encoding

When importing records from a SRU server, the diacritics have bad encoding.
I reproduce with BNF server so it may be a UNIMARC issue.

Tests show that difference between Z39.50 server and SRU is that leader contains 'a' at postion 9.
Looking at MARC::Record->encoding() shows that encoding depends on leader even for UNIMARC.
So this patch adds a call to MARC::Record->encoding('UTF-8') in case of a SRU server in C4::Breeding.

Same use exists in Koha::MetadataRecord::Authority::get_from_breeding().

In case of import via Z3950, MarcToUTF8Record() is called,
 which calls SetMarcUnicodeFlag(),
 which calls MARC::Record->encoding('UTF-8')

Test plan :
1) Use a UNIMARC database
2) Configure a connexion to a UNIMARC SRU, for example BNF,
   see https://doc.biblibre.com/koha/autour_de_koha/serveurs_z3950_sru#serveur_de_la_bnf
3) Go to cataloguing module
4) Click on 'New from Z39.50/SRU'
5) Choose only the SRU target
6) Search for ISBN 2266072889
7) Confirm you see good encoding : diacritic on 'a' of title 'Strate-a-gemmes'
8) Click on 'Marc preview'
9) Confirm you see good encoding
10) Click import
11) Confirm you see good encoding
12) Check also Authorities import via SRU
13) Check also SRU imports on a MARC21 database

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: Removed change to new_from_xml call. We should respect syntax.
But the added MARC::Record encoding does the tric! Which is implicit
for Z3950 targets where MarcToUTF8Record does the same.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25882: Remove phr indicator from limits when processing
Nick Clemens [Fri, 26 Jun 2020 13:19:47 +0000]
Bug 25882: Remove phr indicator from limits when processing

We assume all limits from advanced search to be a phrase and quote them
when doing this we should remove the phrase marker to avoid doulbe quoting

To test:
 1 - Have koha using ES
 2 - Go to advanced search
 3 - Limit by a single itemtype that exists
 4 - Get some results
 5 - Limit by a different itemtype that exists
 6 - Get some results
 7 - Limit by both itemtypes
 8 - Get only the results for the second itemtype
 9 - Enable DumpTemplateVarsIntranet and DumpSearchQueryTemplate
10 - Repeat search
11 - View page source and find 'search_query'
12 - See limit looks like itype:("("BK")" OR "("CR")")
13 - Apply patches
14 - Restart all the things
15 - Repeat search for both itemtypes
16 - Note results now include both types

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25882: Unit test
Nick Clemens [Fri, 26 Jun 2020 13:19:32 +0000]
Bug 25882: Unit test

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26162: Wait for the table to be refreshed
Jonathan Druart [Mon, 10 Aug 2020 09:59:58 +0000]
Bug 26162: Wait for the table to be refreshed

The previous patch did not work as expected. We still got a
StaleElementReference exception.
But this time on
10:43:47 selenium_1   | Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"branchname\"]"}
Because we found the one that existed on the page, not the one sent back
in AJAX.

The idea of this patch is to search for the "Showing 1 to X of Y entries" info and wait for X == Y

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25826: fix failing test
Jonathan Druart [Mon, 10 Aug 2020 08:00:34 +0000]
Bug 25826: fix failing test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: fix failing tests
Jonathan Druart [Mon, 10 Aug 2020 07:57:23 +0000]
Bug 24201: fix failing tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Replace library select
Martin Renvoize [Fri, 7 Aug 2020 14:38:54 +0000]
Bug 24201: (QA follow-up) Replace library select

Removing the library select entirely results in a JS failure for desk
selection when independant branches is enabled and the user does not
have permission to select a library.

This patch adds a hidden select element so we can still grab the current
branch from the selection.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Make logic consistent
Martin Renvoize [Fri, 7 Aug 2020 14:20:55 +0000]
Bug 24201: (QA follow-up) Make logic consistent

The display logic for the desk details in the header bar was
inconsistent between the narrow display view and the full width display
view.  This patch updates the former to match the latter.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) IndependentBranches
Martin Renvoize [Fri, 7 Aug 2020 12:37:30 +0000]
Bug 24201: (QA follow-up) IndependentBranches

This patch updates the IndependentBranches template display logic such
that the 'Select desk' and 'Select library and desk' options appear
correctly when IndependentBranches is enabled.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Add 'and desk' to menus and title
Martin Renvoize [Fri, 7 Aug 2020 10:47:39 +0000]
Bug 24201: (QA follow-up) Add 'and desk' to menus and title

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Another capitalization fix
Josef Moravec [Wed, 5 Aug 2020 05:04:18 +0000]
Bug 24201: (QA follow-up) Another capitalization fix

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Correct call to set_userenv
Martin Renvoize [Tue, 4 Aug 2020 11:49:54 +0000]
Bug 24201: (QA follow-up) Correct call to set_userenv

One call to set_userenv had been implimented incorrectly with the
parameters out of order.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Capitalisation fix
Martin Renvoize [Tue, 4 Aug 2020 11:30:03 +0000]
Bug 24201: (QA follow-up) Capitalisation fix

'Set desk' vs 'Set Desk'.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Only display desks picker if enabled
Martin Renvoize [Tue, 4 Aug 2020 11:28:44 +0000]
Bug 24201: (QA follow-up) Only display desks picker if enabled

I missed a case on the authentication page with the prior patch of the
same name.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Make desk and branch selects on login page consistant
Josef Moravec [Mon, 3 Aug 2020 07:41:47 +0000]
Bug 24201: (QA follow-up) Make desk and branch selects on login page consistant

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Remove setdesk variable and add desk selection script only...
Josef Moravec [Mon, 3 Aug 2020 07:37:10 +0000]
Bug 24201: (QA follow-up) Remove setdesk variable and add desk selection script only on pages in need

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Fix desks select box selected attribute
Josef Moravec [Mon, 3 Aug 2020 07:29:15 +0000]
Bug 24201: (QA follow-up) Fix desks select box selected attribute

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Remove unneeded use
Josef Moravec [Mon, 3 Aug 2020 07:14:51 +0000]
Bug 24201: (QA follow-up) Remove unneeded use

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Do not unbless a list from search in Desks template plugin
Josef Moravec [Mon, 3 Aug 2020 07:11:49 +0000]
Bug 24201: (QA follow-up) Do not unbless a list from search in Desks template plugin

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Re-indent helpers
Martin Renvoize [Mon, 20 Jul 2020 12:38:34 +0000]
Bug 24201: (QA follow-up) Re-indent helpers

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Hide header if desks disabled
Martin Renvoize [Mon, 20 Jul 2020 12:37:59 +0000]
Bug 24201: (QA follow-up) Hide header if desks disabled

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (QA follow-up) Remove deprecated template file
Martin Renvoize [Mon, 20 Jul 2020 12:20:39 +0000]
Bug 24201: (QA follow-up) Remove deprecated template file

The controller associated to this template was deprecated earlier in
this patchset, but the template was left behind.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (follow-up) add desk choice with library choice
Nicolas Legrand [Tue, 28 Apr 2020 10:02:15 +0000]
Bug 24201: (follow-up) add desk choice with library choice

You should be able to add desk choice when you are logging in or
changing library.

Test plan:

1. apply patch
2. have at least three libraries, one without desk, one with one and
one with a few.
3. At login, when choosing a library, it should enable all desks it
has. Pick one.
4. the desk id and name should be set in your session and appear in
the top right, next to the library name.
5. change library and desks from intranet (at the set-library.pl page)
6. you should have the same behaviours
7. if you have a library without a desk, it should prompt you a '---'
option and no desks will be attached to the session.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (follow-up) Rework Desks Plugin
Martin Renvoize [Thu, 26 Mar 2020 14:49:27 +0000]
Bug 24201: (follow-up) Rework Desks Plugin

This patch removes unused plugin methods (they can be re-introduced in
subsequent bugs where they are used) and merges the 'all' and 'defined'
methods into a ListForBranch method that returns a list of desks
associated with the logged in branch.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (follow-up) Use GetLoggedInDeskName
Martin Renvoize [Thu, 26 Mar 2020 13:49:57 +0000]
Bug 24201: (follow-up) Use GetLoggedInDeskName

This patch updates the templates to use the new TT plugin instead of
adding additional variables to the already crouded get_template_and_user.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: (follow-up) Show desk information at lower screen widths
Owen Leonard [Wed, 25 Mar 2020 12:13:10 +0000]
Bug 24201: (follow-up) Show desk information at lower screen widths

The staff client header menu adjusts responsively to narrower viewport
widths, but for the logged-in-user menu this requires showing and hiding
part of the template which duplicates information. This patch adds a
copy of the current desk information to the part of the template shown
at narrower widths.

To test, apply the patch and view any page in the staff client.

 - Narrow your browser so that the viewport is less than 800px wide.
 - The logged-in-user menu should change from text to a single "user"
   icon.
 - Clicking the icon should display a menu which includes labeled
   information about the current desk.

Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24201: Attach desk to intranet session
Nicolas Legrand [Tue, 10 Dec 2019 14:02:31 +0000]
Bug 24201: Attach desk to intranet session

When Desks are defined, a librarian can attach a desk to its session.

Test plan:

1. apply 13881 and create some desks
2. you should see “NO DESK SET” in the intranet header
3. go to circulation > Set desk
4. you should see your desk name in the header, whatever the page
5. you can also set desk with the header menu

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24591: Add --help option to misc/devel/get-prepared-letter.pl
Julian Maurice [Fri, 10 Apr 2020 09:19:47 +0000]
Bug 24591: Add --help option to misc/devel/get-prepared-letter.pl

Also fix code style with perltidy

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24591: Add developer script to preview a letter
Julian Maurice [Wed, 5 Feb 2020 11:20:37 +0000]
Bug 24591: Add developer script to preview a letter

The script is very simple, it just calls GetPreparedLetter with
arguments given on command line and print the resulting letter content

Usage example:

misc/devel/get-prepared-letter.pl --module circulation \
    --letter_code ODUE --tables '{"borrowers":1,"branches":"CPL"}' \
    --repeat '{"item":[{"biblio":1,"items":1}]}' \
    --loops '{"overdues":[1]}'

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works for the example and other cases.
Correct option is 'letter-code', with dash, not underscore.
An usage message would be nice.
No errors

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

JD amended patch: tidy the new file and rename it matching the other
scripts' names in this directory

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25336: Show checkouts/fines to guarantor is in the wrong section of the patron...
David Roberts [Sun, 3 May 2020 23:48:09 +0000]
Bug 25336: Show checkouts/fines to guarantor is in the wrong section of the patron file

This patch moves the "Show checkouts to guarantor" and "Show fines to
guarantor" data to display under the Contact information block

To test:

1) Enable the AllowStaffToSetCheckoutsVisibilityForGuarantor and AllowStaffToSetFinesVisibilityForGuarantor system preferences to Allow
2) View a patron record.
3) The "Show checkouts to guarantor" and "Show fines to guarantor" field
will be on the right hand side of the screen under the Library use
block.
4) Apply patch
5) Check that this data has now moved to the Contact information block
on the left hand side of the patron record.

Works for me!

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25606: (QA follow-up) Don't show remove all button if no reserves
Nick Clemens [Thu, 6 Aug 2020 18:19:58 +0000]
Bug 25606: (QA follow-up) Don't show remove all button if no reserves

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25606: Remove all reserve items button
Joseph Sikowitz [Sat, 23 May 2020 21:45:51 +0000]
Bug 25606: Remove all reserve items button

Adds button to course records to remove all attached reserve items. A warning dialog box will appear before executed.

Test plan
1. Install patch
2. Log in as user with permission to delete reserves
3. View a course reserve record with multiple items attached
4. There should now be a button that says "- Batch remove reserves"
5. When you click the button a dialog box should appear with a warning
6. Click "Ok"
7. All course reserves should be removed from the record
8. Add an item to more than course record
9. Redo 3-7
10. Items should have been removed from that course but remain on all other courses
11. Log in as a user without delete reserves permission
12. You should not see the batch remove option

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25919: Only show Desks in admin navigation when UseCirculationDesks is used
Katrin Fischer [Sat, 18 Jul 2020 10:24:23 +0000]
Bug 25919: Only show Desks in admin navigation when UseCirculationDesks is used

We were missing a check for the UseCirculationDesks in the
template so the "Desks" link would only appear in the admin navigation
when the pref feature is activated.

To test:
- Turn off UseCirculationDesks
- Go to any administration page that shows the navigation on the left
- Verify Desks shows
- Apply patch
- Reload the admin page - Desks should be gone
- Turn on UseCirculationDesks
- Verify the Desks reappear

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25853: Fix file permissions for update_patrons_category script
Katrin Fischer [Sat, 18 Jul 2020 01:53:34 +0000]
Bug 25853: Fix file permissions for update_patrons_category script

The permissions for this were -rw-r--r-- and need to be -rwxr-xr-x.

To test:
- Verify the file permissions before and after applying the patch.

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26009: (QA follow-up) It does not harm to test more
Josef Moravec [Thu, 6 Aug 2020 19:15:44 +0000]
Bug 26009: (QA follow-up) It does not harm to test more

Test plan:
prove t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t
--> should return green

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26009: Add facet size to home/holdingbranch
Nick Clemens [Fri, 17 Jul 2020 16:23:42 +0000]
Bug 26009: Add facet size to home/holdingbranch

To test:
0 - Set DisplayLibraryFacets to 'both' and FacetMaxCount to 20
1 - Have more than 10 branches
2 - Have items in each of those branches
3 - Enable ES, set system preference SearchEngine to Elasticsearch
4 - Search for '*'
5 - Expand homebranch/holdingbranch facets
6 - Note you only get 10
7 - Apply patch
8 - Repeat search
9 - Now you get all your facets

Signed-off-by: Michael Springer <mspringer@mylakelibrary.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26136: Prevent double submit on checkin-form
Nick Clemens [Tue, 4 Aug 2020 13:13:43 +0000]
Bug 26136: Prevent double submit on checkin-form

To test:
 1 - Browse to Circulation->Check-in
 2 - Type a barcode into the Check in box
 3 - Hit Enter as many as times as you can
 4 - Check the statistics table:
    SELECT * FROM statistics WHERE itemnumber={itemnumber} AND DATE(datetime)=CURDATE();
 5 - Note you have multiple lines for the same item at the same time
 6 - Apply patch
 7 - Reload the page
 8 - Type the barcode
 9 - Press Enter even more fast and more furiously
10 - Check the statistics table
11 - Only one entry, huzzah!

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26158: Fix Z3950 search button broken for translations
Jonathan Druart [Thu, 6 Aug 2020 11:29:44 +0000]
Bug 26158: Fix Z3950 search button broken for translations

This is similar to bug 23713

var SEARCH_RESULTS = [% IF (SEARCH_RESULTS) %]1[% ELSE %]0[% END %];

become, once translated:

var SEARCH_RESULTS = [% IF (SEARCH_RESULTS) %]1[% ELSE %][% END %];

and a JS error appears in the console
 Uncaught SyntaxError: expected expression, got ';' search.pl:636:29

Caused by
  commit ef4306cc02e2f15aa2466ae65d0b4f9a1fd70ad9
  Bug 23885: Move staff client search results JavaScript into separate file

Test plan:
Use the staff interface in a translated language
Search for a term that won't return any results
Click the Z3950 button

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26162: Make Selenium click action more robust
Jonathan Druart [Thu, 6 Aug 2020 13:08:48 +0000]
Bug 26162: Make Selenium click action more robust

See
https://stackoverflow.com/questions/12967541/how-to-avoid-staleelementreferenceexception-in-selenium
https://www.selenium.dev/exceptions/
https://developer.mozilla.org/en-US/docs/Web/WebDriver/Errors/StaleElementReference

This patch will fix the following failure we get under D11:
18:47:07 selenium_1   | 09:47:07.478 WARN - Exception: Element not found in the cache - perhaps the page has changed since it was looked up
18:47:07 selenium_1   | For documentation on this error, please visit: http://seleniumhq.org/exceptions/stale_element_reference.html
18:47:07 selenium_1   | Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
18:47:07 selenium_1   | System info: host: '78b9a07f51f2', ip: '192.168.16.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-9-amd64', java.version: '1.8.0_91'
18:47:07 selenium_1   | Driver info: driver.version: unknown
18:47:07 koha_1       |
18:47:07 koha_1       | STRACE: /usr/share/perl5/Try/Tiny.pm:123 in Selenium::Remote::Driver::catch {...}
18:47:07 koha_1       |  /usr/local/share/perl/5.26.1/Selenium/Remote/Driver.pm:353 in Try::Tiny::try
18:47:07 koha_1       |  (eval 1571):1 in Selenium::Remote::Driver::__ANON__
18:47:07 koha_1       |  (eval 1573):2 in Selenium::Remote::Driver::__ANON__
18:47:07 koha_1       |  (eval 1546):17 in Selenium::Remote::Driver::_execute_command
18:47:07 koha_1       |  /usr/local/share/perl/5.26.1/Selenium/Remote/WebElement.pm:63 in Selenium::Remote::WebElement::_execute_command
18:47:07 koha_1       |  /kohadevbox/koha/t/lib/Selenium.pm:184 in Selenium::Remote::WebElement::click
18:47:07 koha_1       |  /kohadevbox/koha/t/lib/Selenium.pm:172 in t::lib::Selenium::click_when_visible
18:47:07 koha_1       |  t/db_dependent/selenium/administration_tasks.t:131 in t::lib::Selenium::click

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25826: (QA follow-up) Add filters
Nick Clemens [Thu, 6 Aug 2020 12:40:20 +0000]
Bug 25826: (QA follow-up) Add filters

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25826: Forbid changing the hidden attributes for biblionumber
Tomas Cohen Arazi [Mon, 27 Jul 2020 15:18:36 +0000]
Bug 25826: Forbid changing the hidden attributes for biblionumber

This patch tweaks the UI so it forbids changing the hidden values when
they are correct (i.e. when they are not hidden in OPAC and intranet).

To test:
1. Apply the first patch
2. Play with the hidden values of the subfield you have mapped to
   biblio.biblionumber in your picked framework. This is usually 999$c
   in MARC21, and 001 in UNIMARC.
=> SUCCESS: When you verify the about.pl, it mentions issues when you
hide in some of the interfaces
3. Apply this patch and reload everything
4. Repeat 2
=> SUCCESS: If your framework is 'ok', it prevents you from editing this
values, otherwise you can change them.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25826: Add a warning to the about page
Jonathan Druart [Wed, 22 Jul 2020 14:43:38 +0000]
Bug 25826: Add a warning to the about page

This patch adds a warning to the about page if the biblionumber field is
hidden at the OPAC or staff interface.

Test plan:
Hide the biblionumber to some framework
Confirm that there is a warning on the about page

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26037: openlibrary.org is hit on every Koha requests
Owen Leonard [Mon, 27 Jul 2020 12:26:41 +0000]
Bug 26037: openlibrary.org is hit on every Koha requests

This patch moves the inclusion of Open Library JavaScript from
opac-bottom.inc to the three templates where it might be used.

In addition, the Open Library JS has been modified to check for the
existence of the relevant markup on the page before executing a query.

Unrelated: The Open Library label is now hidden when the status returned
is "Not found." Previously this information was displayed.

To test, apply the patch and enable the OpenLibrarySearch system
preference.

 - Perform a search in the OPAC which will return results from Open
   Library. Some ISBNs: 014042382603950825520679436405.
   - On the search result page there should be an Open Library "Read
     now" button for each result that can be opened for reading in Open
     Library.
 - Add these titles to a list and view the list.
   - The "Read now" button should appear on the list page.
 - View the details for one of these titles.
   - The "Read now" button should appear on the page below the holdings.
 - Watch the browser's developer tools on these and other pages in the
   OPAC. There should be no errors in the console and no 404 errors in
   the network tab.

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>

3 years agoBug 25683: (follow-up) Use COALESCE instead of IFNULL
Nick Clemens [Tue, 4 Aug 2020 18:28:42 +0000]
Bug 25683: (follow-up) Use COALESCE instead of IFNULL

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25683: Fix grouping of results
Nick Clemens [Wed, 10 Jun 2020 12:26:06 +0000]
Bug 25683: Fix grouping of results

DBIX doesn't seem to work as I expected - if trying to group by we can only
get the columns we grouped by, otherwise the queries are much more complicated
and come out wrong

This patch removes the 'amountoutstanding' from the query. Note that we do return patron
object, however, to access all the columns we must discard_changes (or refetch)

Also fixes a typo 'verbosse'

To test:
1 - charge a $1 fine to a patron
2 - pay off the fine
3 - perl misc/cronjobs/update_patrons_category.pl -f J -t J -fu=5 -v
4 - Note the patron is returned twice
5 - export DBIC_TRACE=1
6 - repeat 3 - view the SQL query and see how odd it is
7 - Apply this patch
8 - repeat 3 - simpler query
9 - patron returned only once

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25683: Patron with no accountlines should have 0 outstanding (not NULL)
Nick Clemens [Tue, 9 Jun 2020 10:52:26 +0000]
Bug 25683: Patron with no accountlines should have 0 outstanding (not NULL)

Test plan:
- Have a patron with nothing in accountlines
- run update_patron_categories to find patrons with fines under $5 (-fu=5)
  - Your patron is not found
  - Give your patron a manual charge of $1
  - rerun the cron, your patron is found
  - pay off your patron's fine, putting their balance at $0
  - rerun the cron, your patron is found

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26131: Remove parentheses in circulation.pref
Lucas Gass [Mon, 3 Aug 2020 21:56:48 +0000]
Bug 26131: Remove parentheses in circulation.pref

To test:
1. Search for a SCO system preference like SCOUserJS.
2. Note that there is a console error on that screen and you cannot open editor.
3. Apply patch
4. Reload the page.
5. No more console error and you can now edit the system pref!

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26125: (bug 23697 follow-up) open patron's details in autocompletion search
Didier Gautheron [Mon, 3 Aug 2020 06:40:06 +0000]
Bug 26125: (bug 23697 follow-up) open patron's details in autocompletion search

Test plan:

1 - Enable PatronAutoComplete syspref
2 - Go to "Patrons" (members/members-home.pl)
3 - Enter a patron first letters in "Search Patron" tab
4 - Select a patron
5 - You're wrongly redirected in koha/circ/circulation.pl
6 - Apply patch
7 - Repeat 3, 4
8 - You're correctly redirected in koha/members/moremember.pl
9 - double check "Check out" redirect hasn't changed

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>

3 years agoBug 26098: Fix JS error on the fund list view when no fund displayed
Jonathan Druart [Thu, 30 Jul 2020 08:51:26 +0000]
Bug 26098: Fix JS error on the fund list view when no fund displayed

TypeError: this.data(...) is undefined
in jquery.treetable.js

Test plan:
Go to the fund list view
Select a filter that will return no result
=> With this patch applied there is no JS error in the console

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>

3 years agoBug 26017: (follow-up) Serverside permission check on registers page
Martin Renvoize [Tue, 4 Aug 2020 14:06:02 +0000]
Bug 26017: (follow-up) Serverside permission check on registers page

This patch adds a serverside permissions check for the display of the
registers summary page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26017: Correct permission check on tools page
Martin Renvoize [Mon, 20 Jul 2020 08:40:00 +0000]
Bug 26017: Correct permission check on tools page

The 'Cashup registers' link from the tools page retained an previous
verions of the permission name. This patch corrects it to use the final
name we sebtled on and thus now correctly displays the link when
appropriate.

Test plan
1/ Enable cash registers via the 'UseCashRegisters' system preference
2/ Ensure you are logged in as a user who has the cash management
   cashup permission.
3/ Verify that the 'Cashup registers' option appears on the tools page.

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26121: Add z-index for CodeMirror
Lucas Gass [Fri, 31 Jul 2020 22:47:21 +0000]
Bug 26121: Add z-index for CodeMirror

To test:
1. Make sure the system preference 'NewsToolEditor' is set to CodeMirror
2. Go add or edit some News content.
3. Add some content to the News section
4. Use the datepicker to pick a Publication date/Expiration date
5. Notice its very hard to see your dates overlapping with CodeMirror.
6. Apply patch
7. Much easier to see the dates!

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>

3 years agoBug 25893: Use wildcards when searching logs
Nick Clemens [Mon, 29 Jun 2020 18:15:39 +0000]
Bug 25893: Use wildcards when searching logs

The restores the wildcards that were used in the past

To test:
 0 - Ensure cataloguing logs and issues logs are enabled
 1 - Edit an item
 2 - Circulate that same item
 3 - Browse to tools-> log viewer
 4 - Put the itemnumber in the 'info' box
 5 - You see only the circulation
 6 - Put the itemnumber in the object box
 7 - You see only the cataloging modification
 8 - Apply patch
 9 - Put itemnumber in info box
10 - you see both actions
11 - Put the itemnumber in the object box
12 - You see only the catalogiong modification

Signed-off-by: Jason Robb <jrobb@sekls.org>

Bug 25893: Don't wildcard object

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Bug 25893: (follow-up) Undo unrelated changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26124: Load TinyMCE assets in correct order
Lucas Gass [Tue, 4 Aug 2020 02:59:32 +0000]
Bug 26124: Load TinyMCE assets in correct order

1. Make sure NewsToolEditor is set to TinyMCE
2. Go to Home › Tools › News › Add news item
3. Observe console error
4. Apply patch
5. No console error

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>

3 years agoBug 26115: Remove leftover Carp::Always
Tomas Cohen Arazi [Fri, 31 Jul 2020 13:17:01 +0000]
Bug 26115: Remove leftover Carp::Always

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25871: DBRev 20.06.00.021
Jonathan Druart [Thu, 6 Aug 2020 09:36:33 +0000]
Bug 25871: DBRev 20.06.00.021

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25871: (QA follow-up) Update syspref
Nick Clemens [Tue, 4 Aug 2020 00:49:35 +0000]
Bug 25871: (QA follow-up) Update syspref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25871: Add "only library" to OpacItemLocation options
Owen Leonard [Tue, 16 Jun 2020 21:34:52 +0000]
Bug 25871: Add "only library" to OpacItemLocation options

This patch adds a new option to the OpacItemLocation system preference,
"only library." It also rewords the descriptions of the existing options
in order to make their use more clear.

To test, apply the patch and make sure your OPACXSLTResultsDisplay
system preference is set to "default."

Test the OPAC search results using each of the OpacItemLocation
preference options:

- location: "library, location, and call number," e.g.

  "Availability: Items available for loan: Athens (1).
   Location(s): Athens new book shelf Call number: JNF 952.025 Bl."

- ccode: "library, collection code, and call number," e.g.

  "Availability: Items available for loan: Athens (1).
   Collection(s): Juvenile non-fiction Call number: JNF 952.025 Bl."

- callnum: "library and call number," e.g.

  "Availability: Items available for loan: AthensCall number: JNF
   952.025 Bl (1)."

- library: "only library," e.g."

  "Availability: Items available for loan: Athens (1)."

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26143: Make the API handle per_page=-1
Tomas Cohen Arazi [Wed, 5 Aug 2020 15:09:40 +0000]
Bug 26143: Make the API handle per_page=-1

This patch introduces handling for per_page=-1 and actually adds a
missing feature to the API: being able to request all resources on a
route.

To test this:
1. Visit the libraries admin page
2. On the table, choose to display 'All' rows
=> FAIL: it doesn't refresh, the browser console displays a 500 error
code and so the logs
3. Apply the tests patches
4. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Pagination.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Tests fail loudly
5. Apply this patch
6. Restart plack
7. Repeat 2
=> SUCCESS: choosing to display all, works
8. Repeat 4
=> SUCCESS: Tests pass now!
9. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26143: Regression tests
Tomas Cohen Arazi [Wed, 5 Aug 2020 15:04:47 +0000]
Bug 26143: Regression tests

This patch introduces tests for the per_page=-1 handling use case. From
now on per_page=-1 means 'all resources'.

On writing this I noticed that we always paginate results no matter
what, but there was a weird condition under which on pagination headers
were sent back to the API consumer. This is highlighted in the precedent
patch, which is not the -1 situation this one tries to tackle.

Both pagination and searching are broken with per_page=-1, which is a
standard, and we actually didn't explicitly set a way to request all
resources.

To verify this:
1. Apply the previous tests patch and this one
2. Run:
   $ kshell
  k$ prove t/Koha/REST/Plugin/Pagination.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> FAIL: Things are damn broken

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26143: The API is always paginated
Tomas Cohen Arazi [Wed, 5 Aug 2020 14:55:28 +0000]
Bug 26143: The API is always paginated

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26133: Remove GetMarcHosts
Jonathan Druart [Tue, 4 Aug 2020 11:55:13 +0000]
Bug 26133: Remove GetMarcHosts

We removed the single occurrence of this subroutine in the previous
patch

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26133: Remove GetMarc* calls in detail.pl
Jonathan Druart [Tue, 4 Aug 2020 11:54:28 +0000]
Bug 26133: Remove GetMarc* calls in detail.pl

There are several calls in catalogue/detail.pl that can be removed:
GetMarcISBN, GetMarcAuthors, GetMarcSubjects, GetMarcSeries, GetMarcUrls and GetMarcHosts
They pass a variable to the template that is never used.

Test plan:
Confirm that this TT variable is never used.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26141: Remove duplicated code from search.pl
Jonathan Druart [Wed, 5 Aug 2020 07:57:56 +0000]
Bug 26141: Remove duplicated code from search.pl

commit 417553a9e47bf31f4cb785162e3dced856a2ac2a
  Bug 12478: starting to add search to staff client

This commit added code related to the itemtypes to the advanced search, but this code already existed.

The weird bit is:
$template->param(advancedsearchesloop => \@advancedsearchesloop);
my $types = C4::Context->preference("AdvancedSearchTypes") || "itemtypes";
my $advancedsearchesloop = prepare_adv_search_types($types);
$template->param(advancedsearchesloop => $advancedsearchesloop);

We are passing twice advancedsearchesloop to the template.

Test plan (for QA):
Review the changes and confirm that we can safely remove this code

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26043: Fix random failure from Holds.t
Jonathan Druart [Wed, 22 Jul 2020 12:11:03 +0000]
Bug 26043: Fix random failure from Holds.t

 #   Failed test 'Test ModReserveMinusPriority()'
 #   at t/db_dependent/Holds.t line 202.
 #          got: undef
 #     expected: '1605'
 # Looks like you failed 1 test of 66.

It is coming from Koha::Patron->holds that is ordering by reservedate,
so "sometimes" they are ordered in reverse (at least it's my
understanding of the problem).

Test plan:
Run the test file several times (from 20 to 60x), it must never fail
with this patch

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26138: Make Koha::Plugins->call return consistent value
Jonathan Druart [Wed, 5 Aug 2020 07:30:31 +0000]
Bug 26138: Make Koha::Plugins->call return consistent value

It must return an empty array in case the enable_plugins config flag is
disabled

Test plan:
Turn the config off in koha-conf
Start a search at the OPAC
Without this patch you got:
  Can't use string ("0") as a HASH ref while "strict refs" in use at /home/vagrant/kohaclone/opac/opac-search.pl line 661
With this patch applied you see the search result

Followed test plan - works as described.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25811: Try to fix the random failure caused by not finding id=login
Jonathan Druart [Mon, 3 Aug 2020 15:57:02 +0000]
Bug 25811: Try to fix the random failure caused by not finding id=login

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24610: Compiled CSS
Jonathan Druart [Mon, 3 Aug 2020 09:57:55 +0000]
Bug 24610: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 24610: Let user switch between 'Pay' and 'Write off' mode
Julian Maurice [Fri, 7 Feb 2020 10:21:43 +0000]
Bug 24610: Let user switch between 'Pay' and 'Write off' mode

In patron's accounting section, under 'Make a payment' tab, you have the
choice between 'Pay' and 'Write off'. It takes you to another form, but
once there you cannot change mode. You have to click on Cancel,
re-select the lines you had selected (if you made a selection) and click
on the right button.

This patch adds link above the form to easily switch between the two
modes.

Also fixes a CSS bug to be able to use Bootstrap's nav pills inside
.statictabs

Test plan:
1. Create some manual invoices
2. Go to 'Make a payment' tab
3. Click on the 'Pay' button in a table row
4. Above the form you should see two links ('Pay' and 'Write off').
   Click on 'Write off', confirm the write off and verify that it did
   make a 'write off'.
5. Go to 'Make a payment' tab
6. Click on the 'Write off' button in a table row
7. Click 'Pay', confirm the pay and verify that it did make a 'pay'
8. Go to 'Make a payment' tab
9. Select some lines and click on 'Pay selected'
10. Click on 'Write off', confirm the 'write off' and verify that it did
    make a 'write off'
11. Go to 'Make a payment' tab
12. Select some lines and click on 'Write off selected'
13. Click on 'Pay', confirm the pay and verify that it did make a 'pay'

Signed-off-by: Christofer <christofer.zorn@ajaxlibrary.ca>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25762: Typo in linkitem.tt
Owen Leonard [Wed, 29 Jul 2020 12:21:29 +0000]
Bug 25762: Typo in linkitem.tt

This patch corrects the same typo in two different templates:

&rsquo; -> &rsaquo;

If you want to test beyond examining the patch, apply the patch
and go to Tools -> Rotating collections.

- Add an item to a rotating collection.
- In the browser's title bar (or the tab title if the title bar isn't
  shown) the separator between the rotating collection name and "Add or
  remove items" should be ">" instead of "`"
- Enable the EasyAnalyticalRecords system preference.
- View the detail page for a bibliographic record.
- From the "Edit" menu, choose "Link to host record"
- Check the title bar as you did previously.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26085: Add the copy, print and export DataTables buttons to lost items report
Owen Leonard [Wed, 29 Jul 2020 12:58:22 +0000]
Bug 26085: Add the copy, print and export DataTables buttons to lost items report

This patch removes the in-page DataTables DOM configuration option so
that the default option is used. This will allow all the standard
controls to appear, including copy/print/export.

Since the default DataTables information includes the number of results
in the table, the template markup showing this information is removed.

To test, apply the patch and go to Reports.

- Run the "Items lost" report using parameters which will return
  multiple results.
- On the results page confirm that the standard controls are present:
  Result count, search form, columns filter, export buttons.
- Confirm that the "Activate filters" feature works, and that selecting
  results activates the option to download a CSV using a CSV export
  profile.

  Note that the "Activate filters" feature doesn't play well with hidden
  columns. However this issue predates the patch.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26094: Add class to the "Suggest for purchase" button
Jonathan Druart [Thu, 30 Jul 2020 12:39:17 +0000]
Bug 26094: Add class to the "Suggest for purchase" button

Bug 14963 added a new "Suggest for purchase" button on the detail page
of bibliographic records at the OPAC.
This patch adds a specific CSS class to make it reachable easily

Like others button in this action list

Test plan:
Go to the detail page of a bibliographic record at the OPAc
Notice the new CSS class

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26004: Remove unused jQuery plugin jquery.hoverIntent.minified.js from the OPAC
Owen Leonard [Fri, 17 Jul 2020 13:20:45 +0000]
Bug 26004: Remove unused jQuery plugin jquery.hoverIntent.minified.js from the OPAC

The jQuery plugin jquery.hoverIntent.minified.js hasn't been used in
Koha in long time. This patch removes it from the OPAC.

To test, apply the patch and search for instances of "hoverIntent."
There should be none.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26011: Remove unused jQuery plugin jquery.metadata.min.js from the OPAC
Owen Leonard [Fri, 17 Jul 2020 18:09:30 +0000]
Bug 26011: Remove unused jQuery plugin jquery.metadata.min.js from the OPAC

The jQuery plugin jquery.metadata.min.js hasn't been used in
Koha in long time. This patch removes it from the OPAC.

To test, apply the patch and search for instances of "jquery.metadata."
There should be none.

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25873: Ignore malformed data for Elasticsearch integer fields
Julian Maurice [Thu, 25 Jun 2020 07:25:41 +0000]
Bug 25873: Ignore malformed data for Elasticsearch integer fields

If we try to put malformed data into an integer field, Elasticsearch
rejects the whole document.
Setting 'ignore_malformed' to true allows to ignore malformed data and
process the other fields of the document normally

https://www.elastic.co/guide/en/elasticsearch/reference/7.8/ignore-malformed.html

Test plan:
* Without the patch
  1. In search engine configuration, change the type of a text field to
  'Number' (for instance 'title')
  2. misc/search_tools/rebuild_elasticsearch.pl -d -b
  3. See that the index is empty (unless you have titles consisting only
  of digits)
* With the patch
  1. misc/search_tools/rebuild_elasticsearch.pl -d -b
  2. Now records are correctly indexed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26084: Clarify language on ConsiderOnSiteCheckoutsAsNormalCheckouts
Andrew Fuerste-Henry [Wed, 29 Jul 2020 15:58:42 +0000]
Bug 26084: Clarify language on ConsiderOnSiteCheckoutsAsNormalCheckouts

To test:
- apply patch
- confirm explanation reads as suggested

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26111: Add "Serials" (SER) to the reports dictionnary
Jonathan Druart [Fri, 31 Jul 2020 09:53:53 +0000]
Bug 26111: Add "Serials" (SER) to the reports dictionnary

It's missing in the template

Test plan:
Go go Home › Reports › Guided reports wizard › Dictionary
At step 2, notice that with this patch you have "Serials" in the
dropdown list (instead of an empty entry)

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26108: Only call the plugin hook if a return took place
Tomas Cohen Arazi [Fri, 31 Jul 2020 12:52:10 +0000]
Bug 26108: Only call the plugin hook if a return took place

This patch makes the hooks be called only if the checkin is effective
(i.e. if it is not rejected for some reason.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26108: Regression tests
Tomas Cohen Arazi [Fri, 31 Jul 2020 12:47:56 +0000]
Bug 26108: Regression tests

The current implementation makes the assumption that if $issue is
defined, then it is the 'return' use case. This is correct, but
incomplete: after verifying that there's actually an issue, the return
can be rejected for various reasons.

This patch introduces a regression test for one of those situations
(which I consider enough for testing purposes) . It highlights that the
hook shouldn't be called if there hasn't been an actual checkin.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Circulation_hooks.t
=> FAIL: Tests fail because there's an unexpected warining printed by
the erroneous plugin call (i.e. there's been no return but the plugin is
called anyway).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25811: (follow-up) Debug - Paste the source of the page
Jonathan Druart [Fri, 31 Jul 2020 10:55:40 +0000]
Bug 25811: (follow-up) Debug - Paste the source of the page

Wide character in syswrite at /usr/share/perl5/File/Slurp.pm line 506.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25887: Keep library filter on the fund list view
Jonathan Druart [Thu, 30 Jul 2020 08:57:53 +0000]
Bug 25887: Keep library filter on the fund list view

The problem:
When filtering funds by library, the pull down for libraries resets to "empty" when the page is reloaded,
although the filter criteria is visible in the URL.

Test plan:
Create a fund for library A
Create a fund for library B
Go to the fund list view
=> All funds are listed
Select library A in the library filter, click "Go"
=> Funds for library A are listed
=> Library filter has "library A" selected
Edit fund for library B
=> The edit form has "library B" selected

Signed-off-by: Holly Cooper <hc@interleaf.ie>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26093: Markup error after Bug 24279 creates formatting problem
Owen Leonard [Wed, 29 Jul 2020 20:01:24 +0000]
Bug 26093: Markup error after Bug 24279 creates formatting problem

This patch makes a few minor changes to the markup of the item detail
page in order for everything to be valid and styled correctly:

- Remove unnecessary and invalid <br clear="both"/>
- Move heading inside container so that floats clear correctly
- Change <span> tag back to <div> to enable the correct style.

To test, apply the patch and view the item details page for a title with
multiple items.

 - Each section starting with "Barcode" should be bordered above by a
   two-pixel gray line
 - The "statuses" section should be styled like the areas above and
   below, not as an ordered list.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25852: Add tests
Jonathan Druart [Thu, 30 Jul 2020 09:59:44 +0000]
Bug 25852: Add tests

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25852: Improve C4::Creators::Lib reliability under plack
Jonathan Druart [Thu, 30 Jul 2020 10:00:03 +0000]
Bug 25852: Improve C4::Creators::Lib reliability under plack

This is certainly a major issue that leads to many side-effects.
Under plack, the structure of the default values are not handled
correctly.
Package variables are used to store stuff like the "layout type". They
are complex structures (arrays of hashes) and returned without being
copied.
When the caller (the controller script) retrieve them then modify the
returned structures, it actually modifies the package's variables.

One of the issue is:
Create a new layout
The script retrieve a structure with all "selected" flags are set to 0
It select the first one as default (BAR as selected => 1)
The user creates the new layout and will selected BIBBAR (for instance)
If you then edit this new layout, the script will retrieve the
"label_types" and set "selected" for BIBBAR. However BAR is still
selected!
The UI receives 2 selected and display the first selected one that has
the selected option.

Test plan:
1. Create a layout type for Barcode/Biblio
2. Choose fields to print and size of font
3. Save
4. Edit existing Layout
=> Withtout this patch "Barcode" is the preselected option
=> With this patch applied, the correct "Barcode/Biblio" option is
selected

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>

3 years agoBug 26108: (bug 25855 follow-up) Call after_circ_action hook only if issue exists
Jonathan Druart [Fri, 31 Jul 2020 07:49:06 +0000]
Bug 26108: (bug 25855 follow-up) Call after_circ_action hook only if issue exists

AddReturn can be called on an item even if it's not checked out (to
trigger holds for instance).
The hook should (?) not be called in that situation

Test plan:
Confirm the above and that the following tests are now passing:
 t/db_dependent/SIP/Message.t
 t/db_dependent/Reserves.t
 t/db_dependent/Circulation/issue.t
 t/db_dependent/SIP/Transaction.t
 t/db_dependent/Circulation.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26083: Item editor defaults to lost
Kyle M Hall [Wed, 29 Jul 2020 17:03:57 +0000]
Bug 26083: Item editor defaults to lost

When editing an item via additem.pl, koha defaults to the first
available lost status, rather than defaulting to not-lost.

Test Plan:
1) Ensure you do not have a value ClaimReturnedLostValue
2) Edit an existing item that is not lost
3) Note the lost value is set even though it is not lost
4) Apply this patch
5) Edit a different item that is not lost
6) Note the lost value is not set!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26061: Compiled CSS
Jonathan Druart [Thu, 30 Jul 2020 15:40:28 +0000]
Bug 26061: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26061: Improve style of sidebar datepickers
Owen Leonard [Fri, 24 Jul 2020 15:59:42 +0000]
Bug 26061: Improve style of sidebar datepickers

This patch makes a small change to the staff interface CSS so that
datepicker form fields in sidebar forms don't force the datepicker icon
onto a second line.

The change uses the CSS calc() function to specify that form fields with
a .hasDatepicker class (dynamically added by jqueryUI) have a width of
100% minus 20 pixels, leaving room for the datepicker icon.

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

- View a page in the staff interface which has a datepicker field in a
  sidebar form and confirm that the icon stays on the same line as the
  firm field at varying browser widths. Examples:

  - Reports -> Saved SQL reports
  - Circulation -> Overdues
  - Acquisitions -> Late orders

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 25953: Add ID to installed plugins table on plugins-home.pl
David Cook [Wed, 8 Jul 2020 12:36:46 +0000]
Bug 25953: Add ID to installed plugins table on plugins-home.pl

This patch adds a "installed_plugins" ID to the table
of installed plugins.

The idea is that it will ease styling and DOM mods through Javascript.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26070: DBRev 20.06.00.020
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000]
Bug 26070: DBRev 20.06.00.020

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

3 years agoBug 26070: Remove GoogleIndicTransliteration system preference
Owen Leonard [Mon, 27 Jul 2020 19:16:07 +0000]
Bug 26070: Remove GoogleIndicTransliteration system preference

The Google Transliterate API was deprecated on May 26, 2011. This patch
removes the feature and associated system preference.

To test, apply the patch and run the database update process.

 - Go to Administration -> System preferences and search for
   'GoogleIndicTransliteration.' There should be no results.
 - Search the Koha codebase for references to
   'GoogleIndicTransliteration.' There should be no current references..

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>

3 years agoBug 22660: DBRev 20.06.00.019
Jonathan Druart [Thu, 30 Jul 2020 15:21:50 +0000]
Bug 22660: DBRev 20.06.00.019

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>