koha.git
3 years agoBug 27149: Unit tests
Nick Clemens [Thu, 3 Dec 2020 17:03:40 +0000 (17:03 +0000)]
Bug 27149: 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 1ae737603f3043c590e33e517d7d95ca8a8283ce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27130: Don't display itemnumber under "File type" section
Nick Clemens [Wed, 2 Dec 2020 07:55:38 +0000 (08:55 +0100)]
Bug 27130: Don't display itemnumber under "File type" section

There is no need to have the "File type" section when we attach a cover
item to an item (we cannot upload a zip file)

This patch removes the fieldset abd adds the itemnumebr to the breadcrumbs and headings.
It also adjusts the help text, removing ZIP as an option when uploading for a biblio or item

Lastly it adjusts the results page to use a heading to make things a bit clearer

Test plan:
 1 - Enable 'LocalCoverImages' system preference
 2 - Browse to the details page for a record
 3 - Under the 'Images' tab click 'Upload'
 4 - Note the display includes File type section with a biblionuber input
 5 - Upload an image and note the results page
 6 - Return to the biblio, this time on the 'Holdings' tab
 7 - Click the down arrow next to 'Edit' and choose 'Upload image'
 8 - Note the form has a File type section with an itemnumber input
 9 - Apply patch
10 - Repeat steps 2-9, making sure changes to page make sense
11 - Note the breadcrumbs have been updated
12 - Confirm you can complete the upload of the cover for an item and that results look as expected

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.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 b66458901268e6cb19585e8de3ea6adb458522fc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26851: Don't generate a notice to library if no content
Nick Clemens [Wed, 28 Oct 2020 19:00:28 +0000 (19:00 +0000)]
Bug 26851: Don't generate a notice to library if no content

To test:
 1 - Check out an over due to a patron
 2 - Set overdue triggers to a trigger less than number of days overdue
 3 - Make sure the patron has no email
 4 - Set content of ODUE notice to:
    [%# Comment will not print %]
 5 - perl misc/cronjobs/overdue_notices.pl
 6 - Check the message queue
 7 - There is a notice sent to the library:
    "These messages were not sent directly to the patrons."
    With no messages
 8 - Apply patch
 9 - Repeat
10 - No new message generated

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
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 9769160083d614601997945f29a0fe9d353bf7ec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26593: Remove _get_discount_from_rule
Nick Clemens [Thu, 19 Nov 2020 15:46:52 +0000 (15:46 +0000)]
Bug 26593: Remove _get_discount_from_rule

This patch remove the private sub used in GetIssuingCharges in favor
of get_effective_rule

It corrects the wrong precedence for rules and adds tests to cover this
subroutine

NOTE: the 'branch' for the discount will be determined by the signed in branch,
    this is a bug to be fixed in the future

To test:
1 - Define a rentalcharge for an itemtype
2 - Define a 10% discount for library A, category A, all itemtypes
3 - Define a 50% discount for all libraries, category A, same itemtype
4 - Attempt to checkout an item from library A of the matching itemtype
5 - The 50% discount is applied
6 - Apply patches
7 - Attempt to checkout an item from library A of the matching itemtype
8 - The 10% discount is applied

prove -v t/db_dependent/Circulation.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
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 c055685ac4f59b2a83730c67792c6fb3c81d2123)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26848: Fix Readonly dependency in cpanfile
Julian Maurice [Wed, 28 Oct 2020 15:29:16 +0000 (16:29 +0100)]
Bug 26848: Fix Readonly dependency in cpanfile

- It is a required module. If it is missing, Koha will not start
- Set the minimum version to 2.00. While not strictly required, it's the
version that states that "Deprecation of Readonly::XS as a requirement
for fast, readonly scalars is complete", it is available in Debian
oldoldstable (jessie, 8), and Readonly::XS was not even needed with Perl
> 5.8, which allows us to:
- Remove dependency on Readonly::XS

Signed-off-by: Mason James <mtj@kohaaloha.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 3af9563a4f52e050461942e4f25c7e9e4918f3d0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 21301: add unit tests
Fridolin Somers [Fri, 4 Sep 2020 08:01:20 +0000 (10:01 +0200)]
Bug 21301: add unit tests

Run t/db_dependent/ILSDI_Services.t with and without previous patches

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>
(cherry picked from commit d828feafbd5f3b788d76a1a79bc4c0522bdb600e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 21301: (follow-up) Remove borrowernumber in issues for GetRecords ILS-DI service
Fridolin Somers [Thu, 26 Mar 2020 12:02:14 +0000 (15:02 +0300)]
Bug 21301: (follow-up) Remove borrowernumber in issues for GetRecords ILS-DI service

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>
(cherry picked from commit 83f5fef84edb0306f401f736008423a5871bdbc5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 21301: (QA follow-up) Fix number of tests
Marcel de Rooy [Fri, 8 Nov 2019 07:07:32 +0000 (07:07 +0000)]
Bug 21301: (QA follow-up) Fix number of tests

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>
(cherry picked from commit 97d94bad13bc2d14a954cb67aca6c6605f9d4906)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 21301: Remove patron informations in reserves for GetRecords ILS-DI service
Fridolin Somers [Thu, 3 Oct 2019 13:43:56 +0000 (15:43 +0200)]
Bug 21301: Remove patron informations in reserves for GetRecords ILS-DI service

Actually, the GetRecords service gives many information :
borrowernumber (reserves field)

The issue data should not be sent by these service, its a privacy problem.

Test plan :
1) Enable ILS-DI webservice
2) Place hold on an item
3) Go to {opac}/cgi-bin/koha/ilsdi.pl?service=GetRecords&id={biblionumber}
4) Check the reserves tag content

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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>
(cherry picked from commit 37c042b9f3d3c307dac8e9205c65227e3c956ee3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 21301: Remove patron informations in issues for GetRecords ILS-DI service
Fridolin Somers [Wed, 2 Oct 2019 14:28:21 +0000 (16:28 +0200)]
Bug 21301: Remove patron informations in issues for GetRecords ILS-DI service

Actually, the GetRecords service gives many information :
bibliographic data (marcxml field)
item data (items field)
issue data (issues field)

The issue data should not be sent by these service, its a privacy problem.
Biblio title and author are redundant.
This patch changes to use Koha::Checkouts to get issues informations with only the addition of item barcode.

Test plan :
1) Enable ILS-DI webservice
2) Checkout an item
3) Go to {opac}/cgi-bin/koha/ilsdi.pl?service=GetRecords&id={biblionumber}
4) Check the issues tag content

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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>
(cherry picked from commit 8ae0ef6eb529cb866914ee8cffba469a9486a53c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24470: Mark a batch as 'imported' if all the bib has been imported
Jonathan Druart [Wed, 9 Dec 2020 14:22:35 +0000 (15:22 +0100)]
Bug 24470: Mark a batch as 'imported' if all the bib has been imported

When a staged MARC file is used to populate a basket in acquisitions,
the status of the batch is kept as "staged" until a user repeat the operation.
The "imported" status is added to the batch when new orders are added to
a basket "from a new file" (yes!...)

Test plan:
- Create a basket
- Add to basket From a New File
- Select a marc file and stage
- Add titles to your basket
Until all your records are imported the batch will have the status
"staged"
When all your records will be imported, the status of the batch will be
"imported"

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 99cebb82dc6fd1aa3f7466f03a267cac9deedc6c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27336: Fix xt/find-missing-filters.t
Jonathan Druart [Mon, 11 Jan 2021 09:20:11 +0000 (10:20 +0100)]
Bug 27336: Fix xt/find-missing-filters.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6be845a785db29a946742edb7c52a0057d6b5f8b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27336: Add POD for new package
Jonathan Druart [Mon, 11 Jan 2021 09:17:25 +0000 (10:17 +0100)]
Bug 27336: Add POD for new package

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0db3787a20e928c2ee8e5b0ce2d636c5bf8763cf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27336: Sanitize correctly HTML id
Julian Maurice [Fri, 8 Jan 2021 09:58:45 +0000 (10:58 +0100)]
Bug 27336: Sanitize correctly HTML id

Valid characters are alphanumeric characters (a-zA-Z0-9), hyphen (-)
and underscore (_)

https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

All invalid characters will be replaced by '_'

Test plan:
1. Go to Administration » System preferences and click on 'Searching'
   tab
2. You should see a console error (Uncaught Error: Syntax error,
   unrecognized expression: #collapse_Did_you_mean/spell_checking)
3. Apply patch
4. Make sure the error is gone
5. prove t/Koha_Template_Plugin_HtmlId.t

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 d89f6027be001d537b0eb73ea3fb4641d5fcd292)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27109: Improve labels on the background job views
Jonathan Druart [Tue, 1 Dec 2020 14:41:56 +0000 (15:41 +0100)]
Bug 27109: Improve labels on the background job views

Replace "enqueued_on" with "Enqueued on", same for started_on and
ended_on

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>
(cherry picked from commit 9ab65aa6c36754db9c6b9e90efde6b05fec147a7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27109: Remove Replay action - not implemented
Jonathan Druart [Tue, 1 Dec 2020 14:43:38 +0000 (15:43 +0100)]
Bug 27109: Remove Replay action - not implemented

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>
(cherry picked from commit 30cb954cc698853423d7afa4ead6716c73ad5c6d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26797: Escape firstname to prevent relative's checkouts to crash
Jonathan Druart [Wed, 2 Dec 2020 10:25:13 +0000 (11:25 +0100)]
Bug 26797: Escape firstname to prevent relative's checkouts to crash

If no firstname is defined for a relative, the "Relative's checkouts"
tab will be "processing" forever.
JS error:
  TypeError: oObj.borrower.firstname is null

Test plan:
1 - Create a patron (PatronA) in a category with type 'Org'
    'School' in sample data works
2 - Add a guarantee (Patron B)
3 - Check out an item to PatronA
4 - Go to PatronB's record and click relativwe's checkouts
5 - There is an error and the table doe snot load
6 - Apply patch
7 - Reload
8 - Table loads correctly

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 13fb0906be41e6f2f5effb89321bcac8371c8b45)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25292: Flushing L1 on every Z3950 server search
Jonathan Druart [Mon, 27 Apr 2020 14:25:32 +0000 (16:25 +0200)]
Bug 25292: Flushing L1 on every Z3950 server search

This patch flushes the L1 cache on each Z3950 server search.

There is no need to flush it in init_handler (when the connection is
made), the L1 cache is not accessed (this behaviour goes against what I
expected).

This means each search will fetch values from the
L2 cache (ie memcached) and persist the L1 cache (in Perl
memory cache) until the result are returned (or longer?).

Test plan:
% perl misc/z3950_responder.pl --config-dir=/kohadevbox/koha/etc/z3950
% zoomsh
ZOOM>connect localhost:2100
ZOOM>set databaseName biblios
ZOOM>search x
ZOOM>search x

Between the 2 searches you can modify the value of SearchEngine, you
will notice that the number of hits is different

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e466c4130406748fdd2d74d5fbee161e4f79cf92)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27349: DBRev 20.11.01.003
Jonathan Druart [Mon, 11 Jan 2021 09:10:06 +0000 (09:10 +0000)]
Bug 27349: DBRev 20.11.01.003

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9f03a9e974a930416e237b846fe78b8e0e5b3404)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27349: (QA follow-up) Move DB update to perl file and add description
Nick Clemens [Fri, 8 Jan 2021 14:37:30 +0000 (14:37 +0000)]
Bug 27349: (QA follow-up) Move DB update to perl file and add description

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 37b5a14f4ca07a6b25960764a4214b00f9831542)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27349: Fix Mana system preference wrong type
Fridolin Somers [Wed, 6 Jan 2021 10:47:59 +0000 (11:47 +0100)]
Bug 27349: Fix Mana system preference wrong type

Mana system preference type 'YesNo' is wrong since it has 3 values.
Change to 'Choice'

Test plan :
1) Run atomic update
2) Check in database 'Mana' system preference type is 'Choice'

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 557d2137d6dcfa1ce6f816c1d55c254418fe581c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27090: Opac basket: fix the 'In transit from' and 'to'
Christophe Croullebois [Wed, 25 Nov 2020 10:29:40 +0000 (11:29 +0100)]
Bug 27090: Opac basket: fix the 'In transit from' and 'to'

To see the 'In  transit from' and 'to' fields in an Opac basket we have :

<span class="item-status intransit">In transit from [% Branches.GetName( item.transfertfrom ) | html %]
    to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %]</span>

But in koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc we have no :

[% USE Branches %]

This patch just corrects this lack

Test plan:
1° find an item in a transit status or create one with this status
2° put it in an Opac basket
3° note that in the location column of the Opac basket the 'In transit from' and 'to' fields are empty.
4° apply the patch
5° check again and validate that the 2 fields are now filled

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7be57c66085071fea763a572ac2a6ceb82641297)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27345: Add missing global permissions for superlibrarian
Jonathan Druart [Tue, 5 Jan 2021 10:35:05 +0000 (11:35 +0100)]
Bug 27345: Add missing global permissions for superlibrarian

When a superlibrarian is logged in, C4::Auth::get_template_and_user pass the CAN_user_$flag to the template, but some are missing:
suggestions, lists, cash_management

So far they are not used in the template but it will avoid a developer to spend time on it if we fix it now.

Test plan:
Compare with installer/data/mysql/mandatory/userflags.sql
Note that we don't need selfcheck

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8c9acd7f28f3204ffb13cf18894a47fcf3f17c85)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26983: Fix [un]select all links in inventory
Jonathan Druart [Wed, 2 Dec 2020 09:26:25 +0000 (10:26 +0100)]
Bug 26983: Fix [un]select all links in inventory

The select/unselect all links took into account only the items displayed
when the page was loaded (so 20).

Test plan:
1. Go to Tools-> Inventory-> Do a Search to produce more than 20 results
2. Select 50, 100 or All entries to show
3. click on Select All
=> All items must be selected, not only the first 20

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 e15446af125d0986cc3d9f122e91b21a5e21c6f6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27351: DBRev 20.12.00.002
Jonathan Druart [Fri, 8 Jan 2021 14:21:22 +0000 (14:21 +0000)]
Bug 27351: DBRev 20.12.00.002

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 555080c1ddb5178d9673b22fde385219d0fd22ec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27351: (QA follow-up) Use skeleton.perl and add description
Nick Clemens [Fri, 8 Jan 2021 13:35:38 +0000 (13:35 +0000)]
Bug 27351: (QA follow-up) Use skeleton.perl and add description

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e6426a540bfdc64c55abc824c901d0ed24dc8779)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27351: Fix UsageStatsCountry system preference wrong type
Fridolin Somers [Wed, 6 Jan 2021 14:32:37 +0000 (15:32 +0100)]
Bug 27351: Fix UsageStatsCountry system preference wrong type

UsageStatsCountry system preference type 'YesNo' is wrong since it has
several values.
Change to 'Choice'.
Looks like this error whas only in updatedabase 3.17.00.030.

Test plan :
1) Run atomic update
2) Check in database 'UsageStatsCountry' system preference type is
   'Choice'

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 bbab6615637c60c757df79bdc695a606622ed96a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27164: Fix item search CSV export
Fridolin Somers [Mon, 7 Dec 2020 16:03:40 +0000 (17:03 +0100)]
Bug 27164: Fix item search CSV export

In item search CSV export, data cells are exported with double quotes.
There should also be double quotes in header cells.
Also some spaces can be removed.
Delimiter must be from system preference 'delimiter'.
TT filter must be $raw not html, only double quotes must be espaped by
duplication of it.

This may help to open the CSV with any table/calc software.

Test plan :
1.0) Create a record with title : Laurel & "Hardy"
1.2) Create an item on this record
2.0) Without patch
2.1) Perform an item search on title 'Laurel'
2.2) Export as a CSV file and save the file locally
2.3) Open the file with a table/calc software
3.0) Apply patch
3.1) Perform same item search
3.2) Export as a CSV file and save the file locally
3.3) Open the file with a table/calc software
4.0) Compare files with diff/meld
=> you see double quotes arround header cells
   and removal of space after coma
4.1) Check that delimiter is from system preference 'delimiter'
4.2) In table/calc software they should look the same

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1700c393b1de3c32b3b572efd0cf935255813e2b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26417: Remove warn in Koha::Patron is_valid_age
Fridolin Somers [Wed, 9 Sep 2020 11:54:34 +0000 (13:54 +0200)]
Bug 26417: Remove warn in Koha::Patron is_valid_age

In Koha::Patron is_valid_age the is a compare : $age < $low
But $low may be undef.
It generates a warn :
Use of uninitialized value $low in numeric lt (<)

Needs a test like for $high.

Test plan :
1) Run prove t/db_dependent/Koha/Patrons.t
2) Edit a patron catetory, empty "Age required" and save
3) Edit a patron of this category
4) Check in logs you don't see "Use of uninitialized value $low in numeric lt (<)"

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f042c804cda09deaee614f73ec9a888bea4ab99a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27292: Add TablesSettings directive to fix columns_settings_borrowers_table
David Cook [Wed, 23 Dec 2020 04:41:58 +0000 (04:41 +0000)]
Bug 27292: Add TablesSettings directive to fix columns_settings_borrowers_table

This patch adds the USE TablesSettings directive which allows the plugin
to be invoked to fill the columns_settings_borrowers_table variable.

Test plan:
0. Do not apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/reserve/request.pl?borrowernumber=51&biblionumber=29
2. View source on the page and note columns_settings_borrowers_table has no value assigned
2. Apply the patch
3. In a new tab, go to http://localhost:8081/cgi-bin/koha/reserve/request.pl?borrowernumber=51&biblionumber=29
4. Note that nothing has changed on the surfeace
5. View source ont he page and note columns_settings_borrowers_table now has a value assigned

Signed-off-by: Lucas Gass <lucas@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 31ec92bfab16654b2a3f763d141559d0f882a1e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27245: Replace AutoCommit=0 with txn_begin in bulkmarcimport.pl
Jonathan Druart [Fri, 18 Dec 2020 13:41:12 +0000 (14:41 +0100)]
Bug 27245: Replace AutoCommit=0 with txn_begin in bulkmarcimport.pl

To prevent
DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1588, <GEN45> line 1.

Test plan:
1 - Export more than 100 records
2 - Use bulkmarcimport (with -commit=10) to import them
    perl misc/migration_tools/bulkmarcimport.pl -b -file testbmi.xml -v -m=MARCXML --commit=10
3 - Modify a record to make the import fail (for instance having a too long
lccn)
4 - Use bulkmarcimport (with -commit=10) to import them
    perl misc/migration_tools/bulkmarcimport.pl -b -file testbmi.xml -v -m=MARCXML --commit=10
5 - Notice that the import stops but that the imported record are imported (apart from the last batch of 10)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4a90c0b647fdfdb0a39b43f6b10adba3bca53215)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26367: Prevent warn about undefined values when record level hold has an itemtype
Nick Clemens [Thu, 3 Sep 2020 12:15:57 +0000 (12:15 +0000)]
Bug 26367: Prevent warn about undefined values when record level hold has an itemtype

To test:
 1 - set AllowHoldItemTypeSelection to 'Allow'
 2 - Find a patron from Library A
 3 - Find a record with an item from Library A
 4 - Place a title level hold with itemtype specified for a delivery at Library A for patron and record above
 5 - perl misc/cronjobs/holds/build_holds_queue.pl
 6 - There are warns:
 Use of uninitialized value in hash element at /kohadevbox/koha/C4/HoldsQueue.pm line 523.
 Use of uninitialized value in string eq at /kohadevbox/koha/C4/HoldsQueue.pm line 523
 7 - Apply this patch
 8 - perl misc/cronjobs/holds/build_holds_queue.pl
 9 - No more warns!
10 - prove -v t/db_dependent/HoldsQueue.t
11 - All tests pass!

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 d2e2a3975fb66d8c2e2766ecbe014fb71952e6d0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26367: Unit test
Nick Clemens [Thu, 3 Sep 2020 12:06:51 +0000 (12:06 +0000)]
Bug 26367: Unit test

This warn only appears when:
  The borrower and item branches match
  AND
  The hold fulfillment policy is any or the pickupbranch matches the items branch specified by hold_fulfillment_policy
  AND
  The request has an itemtype set

To trigger we simply add some itemtype to existing hold requests in the test

To test:
1 - prove -v t/db_dependent/HoldsQueue.t

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 cd83fbe58d6f3ee2cd15880acaaccd495007c83f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26364: Don't skip records that match the isbn we passed
Nick Clemens [Wed, 9 Sep 2020 13:24:20 +0000 (13:24 +0000)]
Bug 26364: Don't skip records that match the isbn we passed

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 86617ba7cd54cbeb7f2241468cd3e10f20d2bc27)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26364: Remove false matches on isbn
Nick Clemens [Wed, 9 Sep 2020 13:33:17 +0000 (13:33 +0000)]
Bug 26364: Remove false matches on isbn

The test here was returning 0590353403 when searched for 9780590353403
because of the regex matching

Koha doesn't work this way unless SearchWithISBNVariations is set to 'search'
and you use a dropdown to select ISBN for searching

To test:
1 - Search catalog for nb=9780590353403
2 - Confirm you don't have results, or delete the records with results
3 - Add isbn 0590353403 to a record
4 - Repeat search, fails
5 - Enable SearchWithISBNVariations
6 - Repeat search, fails
7 - Go to advanced search, select ISBN, search for 9780590353403
8 - Get results

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 854d404a9c161845731d39980165f8d641713a80)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26364: Remove useless condition
Nick Clemens [Wed, 9 Sep 2020 13:40:37 +0000 (13:40 +0000)]
Bug 26364: Remove useless condition

$response_data is a hash with one key, content

Why are we checkiing it against a string?

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 8b22c3846caa2004b411c6bd19a5d41bc602e704)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26364: Don't discard the passed isbn
Nick Clemens [Wed, 9 Sep 2020 13:44:45 +0000 (13:44 +0000)]
Bug 26364: Don't discard the passed isbn

I don't know, if we get rid fo this check we can now check the db for the same isbn we passed

This may be useful as we may want to see the biblio with the same isbn as long as number is different?

This will make tests fail

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 feb7f5f6dd89f58f3b027898705fb0fa57a051ab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26364: Adjust unit tests
Nick Clemens [Wed, 9 Sep 2020 14:34:26 +0000 (14:34 +0000)]
Bug 26364: Adjust unit tests

We shouldn't rely on knowing exactly which ISBNs we get, we should specifically
check for what we do or don't expect.

I believe we should return biblios that have the same isbn we passed, as it signlas we have another
biblio in the catalog that matches the one we are on.

To test:
prove -v t/db_dependent/XISBN.t

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 d9063ba246bd020de83bc67964a08855a73ccb24)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27252: DBRev 20.11.01.001
Jonathan Druart [Thu, 7 Jan 2021 14:36:20 +0000 (14:36 +0000)]
Bug 27252: DBRev 20.11.01.001

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27252: Add deprecation warning, cross_fields pref, and add version to ES info
Nick Clemens [Wed, 16 Dec 2020 18:50:55 +0000 (18:50 +0000)]
Bug 27252: Add deprecation warning, cross_fields pref, and add version to ES info

This patch prepares Koha to officially no longer support Elasticsearch 5.X

It adds a new system preference 'ElasticsearchCrossFields' to allow users to choose whether or not
to enable this feature

It updates the about page to add a deprecation warning if a site is running ES5

To test:
 1 - Be running Koha with Elasticsearch 5.X
 2 - Attempt to search
   Error: Unable to perform your search. Please try again.
 3 - Apply patch
 4 - Update database
 5 - Searching works
 6 - Find syspref 'ElasticsearchCrossFields'
 7 - Enable it
 8 - Searching is now broken
 9 - Check the about page
 10 - you can now see the Elasticsearch version
 11 - The systeminformation tab has a deprectaion warning
 12 - Set SearchEngine preference to 'Zebra'
 13 - View the about page - no warnings
 14 - Test again with ES6 - searching should "work" with either pref setting
 15 - There should be no warning on about pages

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 181267bd2bf66a5efd065b48149eed4ff1044599)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26847: (follow-up) fix get_attribute() call
Victor Grousset/tuxayo [Tue, 5 Jan 2021 12:56:32 +0000 (13:56 +0100)]
Bug 26847: (follow-up) fix get_attribute() call

Since the upgrade to Selenium 3 in bug 27055, an additional parameter is
required for get_attribute() to actually work.
https://metacpan.org/pod/Selenium::Remote::WebElement#get_attribute

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit de739259298b323bb881b62b1bc96bc9e3589496)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26847: Add data-categorycode to opac pages
Martin Renvoize [Wed, 4 Nov 2020 14:53:57 +0000 (14:53 +0000)]
Bug 26847: Add data-categorycode to opac pages

This patch adds the data-categorycode attribute to the loggedinuser span
for all pages in the opac.

Test plan
1/ Apply first patch, varify unit test fails.
2/ Apply second patch, varify unit test now passes.
3/ Navigate to opac and login
4/ Varify that data-categorycode is present in the loggedinuser span in
the client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c7e228c60cfe352ccd7f1dee54990dcaa22c0240)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26847: Add UI test for categorycode in masthead
Martin Renvoize [Wed, 4 Nov 2020 14:45:27 +0000 (14:45 +0000)]
Bug 26847: Add UI test for categorycode in masthead

This test adds a regression test for the addition of categorycode
into the masthead of the staff client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 69bf6e80cf4c35601dbeea871c973c7ce3997e41)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24863: QueryFuzzy syspref says it requires Zebra but ElasticSearch has some support.
Lisette Scheer [Sat, 24 Oct 2020 19:09:59 +0000 (19:09 +0000)]
Bug 24863: QueryFuzzy syspref says it requires Zebra but ElasticSearch has some support.

This patch updates the description of the QueryFuzzy system preference
to make it more clear how it works with Zebra and how Elasticsearch has
some amount of fuzzy available for searches.

To test:
1. Go to administration
2. Search for QueryFuzzy
3. Observe the current description, which only includes Zebra.
4. Apply patch
5. Repeat steps 1-2
6. Observe the updated description.
7. Sign off

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 137cf586551be4affb112eba3a61bc49b0099342)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24541: Purge old messages
Didier Gautheron [Thu, 30 Jan 2020 09:35:31 +0000 (10:35 +0100)]
Bug 24541: Purge old messages

misc/cronjobs/cleanup_database.pl provides some database cleanup.

This patch adds cleanup for messages table.

Test plan :
- Count messages : select count(*),date(message_date) from  messages group by date(message_date);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --confirm --messages 365
- Recount messages

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ead1493f5b3baedcc1eaf062991b8792aba7f231)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25462: Compiled CSS
Jonathan Druart [Mon, 4 Jan 2021 15:31:27 +0000 (16:31 +0100)]
Bug 25462: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ae1ae478fd5004ba8527822aef9ce5b45b061a33)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25462: (follow-up) Remove <br /> as it is no longer needed
Martin Renvoize [Thu, 5 Nov 2020 11:34:54 +0000 (11:34 +0000)]
Bug 25462: (follow-up) Remove <br /> as it is no longer needed

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 847ef673440733c3e76bf4c520838bf8fa3db3eb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25462: Show shelving location on a new line after home library (OPAC)
Owen Leonard [Tue, 12 May 2020 12:44:45 +0000 (12:44 +0000)]
Bug 25462: Show shelving location on a new line after home library (OPAC)

This patch updates the OPAC CSS to move the shelving location a
new line after the 'Home library' in list of holdings on the
bibliographic detail page.

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

- Locate a title in the OPAC which has items with a shelving
  location.
- View the detail page for that title. In the table of holdings,
  confirm that the shelving location information is on a separate line
  from the home library information.

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 0da7cd5359bd1b2b96b2fd9204a07e5e10b45948)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25462: Show shelving location on a new line after home library (staff client)
Owen Leonard [Tue, 12 May 2020 12:43:21 +0000 (12:43 +0000)]
Bug 25462: Show shelving location on a new line after home library (staff client)

This patch updates the staff client CSS to move the shelving location a
new line after the 'Home library' in list of holdings on the
bibliographic detail page.

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).

- Locate a title in the staff client which has items with a shelving
  location.
- View the detail page for that title. In the table of holdings,
  confirm that the shelving location information is on a separate line from
  the home library information.

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 088e798ea33b43c7dfe9a3aa3e6cdd895d32dc9c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25462: Shelving location should be on a new line in holdings table
David Roberts [Tue, 12 May 2020 09:56:28 +0000 (09:56 +0000)]
Bug 25462: Shelving location should be on a new line in holdings table

This patch moves the shelving location a new line after the Home library
in the holdings table.

To test:

1) Assign a shelving location with a long description to an item.
2) See that it displays on the same line as the Home Library in /cgi-bin/koha/catalogue/detail.pl
3) Apply the patch
4) Check that the shelving location is now on a new line

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 287d4aae129cb2958eae67073b9208b7db94bef4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26875: (follow-up) Fix error message ("greater or equal")
Victor Grousset/tuxayo [Mon, 28 Dec 2020 17:28:58 +0000 (18:28 +0100)]
Bug 26875: (follow-up) Fix error message ("greater or equal")

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a7bc53d9431b32d6560f3cf987d2c4e30c6cf34c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26875: Allow printing of just one barcode in batch
Andrew Fuerste-Henry [Fri, 30 Oct 2020 16:25:05 +0000 (16:25 +0000)]
Bug 26875: Allow printing of just one barcode in batch

To test:
1- go to the Print Barcode Range page
2- enter From=1 and To=1
3- confirm error "Must be greater than from value."
4- apply patch, restart, reload page
5- enter From=1, To=1
6- confirm no error
7- change From to 2, error reappears

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e581255eccb1b6851735f9eb2c297dd0c01ffa06)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27085: Corrections in overdue_notices.pl help text
Timothy Alexis Vass [Wed, 25 Nov 2020 07:45:39 +0000 (07:45 +0000)]
Bug 27085: Corrections in overdue_notices.pl help text

-library      <branchname>     only deal with overdues from this library (repeatable : several libraries can be given)
Should be <branchcode>

Help text should also be proper sentences.

To test:
0) Run misc/cronjobs/overdue_notices.pl -h
1) Check that the text is now:
   -library      <branchcode>     Only deal with overdues from this library.
2) Check that the rest of the help text are proper sentences,
   with leading capital letter and punctuation.
3) Sign off.

Sponsored-by: Lunds Universitetsbibliotek
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1ad7d034e65d0b518335086345f2f533d1898c56)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25954: Prevent two elements with id="description" in the DOM
Jonathan Druart [Mon, 4 Jan 2021 14:09:19 +0000 (15:09 +0100)]
Bug 25954: Prevent two elements with id="description" in the DOM

It also fixes t/db_dependent/selenium/administration_tasks.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b13982d6a52dc9660e0d35ccfc40193774a336a4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25954: Compiled CSS
Jonathan Druart [Mon, 4 Jan 2021 12:59:38 +0000 (13:59 +0100)]
Bug 25954: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4d7b353b628077d99d7503a3afb343e315d00e1e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25954: (QA follow-up) Correct label "for" attribute in authorities search
Josef Moravec [Tue, 17 Nov 2020 17:34:12 +0000 (17:34 +0000)]
Bug 25954: (QA follow-up) Correct label "for" attribute in authorities search

Change it from first select box to text input for consistancy with other
search forms

Test plan:
1) Apply the patch
2) Go to authorities search
3) Confirm the labels in all search tabs are linked to text input field

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3b2bd038279911e8f29b376b2e70a2b9f9b6bb66)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25954: (follow-up) Correct label "for" attribute
Owen Leonard [Thu, 6 Aug 2020 19:09:43 +0000 (19:09 +0000)]
Bug 25954: (follow-up) Correct label "for" attribute

This patch updates a couple of search include forms to change the "for"
attribute of the label. Although "idx" is the first field in this
situation, the label's text applies to the keyword field so it should
give focus to the keyword field.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1920c92d811dc5477a9cb1064f6f7e2dd473a380)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25954: Replace paragraph tags with labels in header search forms
Owen Leonard [Wed, 8 Jul 2020 13:40:37 +0000 (13:40 +0000)]
Bug 25954: Replace paragraph tags with labels in header search forms

This patch replaces instances of <p class="tip"> with <label
class="tip"> in header search forms where there is not already a label
tag corresponding to the first form field.

In cases where there is already a label on the first form field the <p>
is kept.

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)

Test the header search forms on the following pages:

 - Staff interface home page
 - Acquisitions home
 - Acquisitions -> Vendor -> Contracts
 - Acquisitions -> Vendor -> Add to basket -> From a suggestion
 - Advanced catalog search
 - Authorities
 - Administration
 - Administration -> Funds
 - Administration -> Desks (UseCirculationDesks must be enabled)
 - Administration -> Cities and towns
 - Administration -> Currencies and exchange rates
 - Administration -> Patron categories
 - Administration -> Z39.50/SRU servers
 - Catalog -> Search results
 - Cataloging
 - Circulation
 - Circulation -> Check in
 - Patrons
 - Serials
 - Tools -> Notices and Slips

In each case, check that the search form labels work as expected to move
focus to the corresponding form field.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 38bc9eb2a8c01c8625b1c33c7e098cd0022b2710)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27178: Add 'str' namespace to exclude-result-prefixes
Jonathan Druart [Thu, 10 Dec 2020 10:35:50 +0000 (11:35 +0100)]
Bug 27178: Add 'str' namespace to exclude-result-prefixes

Some nodes in the generated HTML document contain the 'str' namespace.
For instance, at the OPAC on the search result list, you can see:
<a xmlns:str="http://exslt.org/strings" href="/cgi-bin/koha/opac-detail.pl?biblionumber=18566&amp;query_desc=kw%2Cwrdl%3A%20spin" class="title">

The solution is to add 'str' to exclude-result-prefixes.
From https://developer.mozilla.org/en-US/docs/Web/XSLT/Element/stylesheet
"""
Specifies any namespace used in this document that should not be sent to the output document. The list is whitespace separated.
"""

Test plan:
0. Don't apply this patch
1. Launch a search at the OPAC
2. Inspect the title link for the records
=> Note the 'xmlns:str' attribute on tag "a"
3. Apply this patch
4. restart_all
5. Repeat 1. and 2.
=> Note that the attribute is gone now.

QA will check that no other occurrences is missing (note that one
NORMARC xsl is missing it, but NORMARC is deprecated)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 71aaf8b458254921022b5e14440f158c8c7eb7bd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27168: Sort most popular by number of issues desc
Jonathan Druart [Wed, 9 Dec 2020 15:27:41 +0000 (16:27 +0100)]
Bug 27168: Sort most popular by number of issues desc

It seems that there is a weird behavior when the title is used as a
second sort

Test plan:
Turn on OpacTopissue
Make sure the table always displays entries sorted by number of issues
desc

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit b42e08029e91fdb2d3cb9a8725314236d862269c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26953: Hide phone and itiva from "Overdue notice/status triggers"
Jonathan Druart [Wed, 2 Dec 2020 09:52:27 +0000 (10:52 +0100)]
Bug 26953: Hide phone and itiva from "Overdue notice/status triggers"

If the prefs are off we should not display the checkboxes

Test plan:
1. Turn off PhoneNotification and TalkingTechItivaPhoneNotification
2. Go to the "Overdue notice/status triggers" and confirm that phone and
itiva columns are not displayed
3. Turn the prefs on and confirm the checkboxes are now displayed

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6ef7cbededc424e93622b30832ebc7f609d7308d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27310: Remove CSS float on 'Visibility' in framework edition
Fridolin Somers [Tue, 29 Dec 2020 10:55:25 +0000 (11:55 +0100)]
Bug 27310: Remove CSS float on 'Visibility' in framework edition

In administration > framework edition > subfield edition, 'Visibility' label as a CSS rule float none.
This seems obsolete, removing it will align label like others.

Test plan :
1) Go to Administration
2) Edit any framework
3) Edit any subfield
4) Look at 'Visibility'
=> Without patch label is sticked to the left
=> With patch label postion is like others

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 48b39167bb2f7fc06ece57d0fbcf94fe949b426a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc
David Cook [Thu, 24 Dec 2020 00:07:04 +0000 (00:07 +0000)]
Bug 27031: Use Koha.Preference() more often in header.inc and js_includes.inc

This patch uses the Koha.Preference() macro more often in key includes.
(In the longer term, it will help reduce dependency in problematic C4::Auth code.)

Test plan:
0. Apply patch
1. Go to http://localhost:8081/cgi-bin/koha/mainpage.pl
2. Note "Cart" link in nav bar
3. Click "Cart" and note "Your cart is currently empty" text
4. Click "More" and note "Course Reserves" in dropdown menu
5. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=test
6. Click "Select all" above search results
7. Click "Add to cart"
8. Note "Cart" now has 3 displaying next to it
9. Click "Cart"
10. Note there are three titles in the cart
11. Click "Empty and close" and click "OK" to confirm
12. Note "Cart (0)" now appears in the top nav
13. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=IntranetNav
14. Save the following content in the system preference: <li><a href="/index.html">New Home</a></li>
15. Refresh the page
16. Note "New Home" appears in the top nav between "Cart" and "More"

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>
(cherry picked from commit 4186a5873bdeca5b57b153f07494d800ca93cb8b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26996: Convert Elasticsearch indexer commit buffer size to integer
Björn Nylén [Wed, 11 Nov 2020 07:35:21 +0000 (08:35 +0100)]
Bug 26996: Convert Elasticsearch indexer commit buffer size to integer

When multithreaded indexing is used, the commit size for children are spread
out resulting in them being of type float. When records are processed and the
commit counter decreased it may then never reach *exactly* 0. This means records
are never commited. This patch makes sure the counter is an integer to avoid the
problem.

To test you must find a set of circumstances that causes the issue. For me:
1. Run: ./rebuild_elasticsearch -v -b -p 2 -c 400
2. Note that only one process is logging "Committing xxx records..."
3. Kill processes.
4. Apply patch.
5. Repeat 1
6. Note that both processes are logging "Committing xxx records..."

Sponsored-by: Lund University Library
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ba9c9cc794123d60c92a4ce499aa4554299936b6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27135: Adjust "upload image" button when viewing item's cover images
Jonathan Druart [Thu, 3 Dec 2020 08:40:45 +0000 (09:40 +0100)]
Bug 27135: Adjust "upload image" button when viewing item's cover images

When viewing the cover image of an item, the "upload image" button is
about to upload an image at biblio level.

Test plan:
- Attach a cover image to an item
- View it
- Notice the "Upload image" button, confirm that with this patch applied
the wording changed and that clicking it will attach a cover image to
the item
- Attach a cover image to the biblio
- View it
- Notice the "Upload image" button, confirm that with this patch applied
the wording changed and that clicking it will attach a cover image to
the biblio

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 f0209415245fec941f44ed40ee47d8f163e5bb48)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27043: Add to number_of_replicas and number_of_shards to index config
Fridolin Somers [Tue, 17 Nov 2020 13:49:58 +0000 (14:49 +0100)]
Bug 27043: Add to number_of_replicas and number_of_shards to index config

With Elasticsearch 6 (>6.4), we have a warning on index creation :
  the default number of shards will change from [5] to [1] in 7.0.0

See https://github.com/elastic/elasticsearch/pull/30587

I propose to add number_of_shards in index config.

Also add number_of_replicas that is better explicit.
In case on only one node, it must be 0.

Test plan :
1) Use Elasticsearch
2) Apply patch and flush memcached
3) Rebuild indexes : misc/search_tools/rebuild_elasticsearch.pl -v -b -d
4) Check you dont have a warning about number of shards
5) Check the settings of index :
   curl '<cluster>:9200/<myindex>_biblios/_settings?pretty&filter_path=**.number_of_*'
6) You should see :
   "number_of_shards" : "5",
   "number_of_replicas" : "1"

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3dc90c66c7e3e53c6fab1792ebac65767e770c5e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26171: (QA follow-up) Add table name and object type to message
Nick Clemens [Mon, 21 Dec 2020 19:24:05 +0000 (19:24 +0000)]
Bug 26171: (QA follow-up) Add table name and object type to message

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0f7bbb64df376cd0998d6e882ad2f0a699187863)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26171: adapt Koha/Exceptions.t
Fridolin Somers [Fri, 7 Aug 2020 08:30:55 +0000 (10:30 +0200)]
Bug 26171: adapt Koha/Exceptions.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c961b238a2c726f7bf2dc70a672d31c43da84f29)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26171: Show biblionumber in Koha::Exceptions::Metadata::Invalid
Fridolin Somers [Fri, 7 Aug 2020 08:05:52 +0000 (10:05 +0200)]
Bug 26171: Show biblionumber in Koha::Exceptions::Metadata::Invalid

Bug 23846 added a check for invalid MARCXML in search_for_data_inconsistencies.pl.
But the error message does not show the biblionumber of invalid biblio record.

Test plan:
1) Import a bibliographic record with invalid XML, you can add non printable characters, like 0x1F (CTRL-V 1F with vim)
2) Run misc/maintenance/search_for_data_inconsistencies.pl
3) Check you see correct biblionumber in error message :
Invalid data, cannot decode object (id=xxx, biblionumber=yyy, format=marcxml, schema=zzz, decoding_error=...

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3b987412f699d16794520e1b3ec1b04b82fdd4e4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27280: (bug 27026 follow-up) Make consistent the explanation for "Days mode"
Jonathan Druart [Fri, 18 Dec 2020 15:23:54 +0000 (16:23 +0100)]
Bug 27280: (bug 27026 follow-up) Make consistent the explanation for "Days mode"

We have "Skip closed days" in the dropdown, but "Calendar" on the table. Both must match

Test plan:
Go to the circ rules, select a value for "Days mode", save the rule,
confirm that the dropdown list values are matching the ones we displayed
in the cells

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>
(cherry picked from commit 8a067f145b85870328fbcd10b2e510cb7006b749)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoUpdate release notes for 20.11.01 release v20.11.01
Fridolin Somers [Wed, 6 Jan 2021 16:27:31 +0000 (17:27 +0100)]
Update release notes for 20.11.01 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoIncrement version for 20.11.01 release
Fridolin Somers [Wed, 6 Jan 2021 16:07:57 +0000 (17:07 +0100)]
Increment version for 20.11.01 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoTranslation updates for Koha 20.11.01
Koha translators [Wed, 6 Jan 2021 08:47:26 +0000 (05:47 -0300)]
Translation updates for Koha 20.11.01

3 years agoBug 27004: Prevent claim resolution to fail
Jonathan Druart [Mon, 21 Dec 2020 10:05:26 +0000 (11:05 +0100)]
Bug 27004: Prevent claim resolution to fail

If the account of the patron who created a claim is removed, then the
claim won't be resolvable.
Trying to resolve the claim will result in a 500:
[2020/12/21 10:05:55] [ERROR] PUT /api/v1/return_claims/1/resolve: unhandled exception (Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy)<<[created_by is mandatory]>> Koha::REST::Plugin::Exceptions::__ANON

We should not check if created_by exist when we update an existing hold,
only when we create it.

Test plan:
- Login with patron A
- set a value to syspref ClaimReturnedLostValue
- Check an item out
- Claim returned it
- Login with patron B
- Delete patron A
- Resolve the claim
- ERROR in api-error.log an UI never confirming the resolution
- apply patch & restart services
- Resolve the claim
- it works

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 92dbe809021ea1f7ee44e51387b48d9ffbda1fea)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27004: Regression tests
Tomas Cohen Arazi [Tue, 29 Dec 2020 17:35:27 +0000 (14:35 -0300)]
Bug 27004: Regression tests

This patch introduces regression tests for the change in
Koha::Checkouts::ReturnClaim->store.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t
=> FAIL: Tests fail

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c4702149b2a9d3ec6216a7526a2c52b91de5d4cd)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27276: Fix syntax error
Kyle M Hall [Mon, 4 Jan 2021 13:12:25 +0000 (08:12 -0500)]
Bug 27276: Fix syntax error

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4f112b782b706d906fb39dd0d7a708f7d12da45f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27276: Prevent borrowers-force-messaging-defaults.pl to crash
Jonathan Druart [Fri, 18 Dec 2020 13:28:13 +0000 (14:28 +0100)]
Bug 27276: Prevent borrowers-force-messaging-defaults.pl to crash

MySQL 5.7 does not allow queries using 0000-00-00

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f228c9ee9fc7094054b687b26ae4306254922019)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 17809: FR installer: fix duplicate authorised value qualif 370
Victor Grousset/tuxayo [Mon, 28 Dec 2020 14:48:25 +0000 (15:48 +0100)]
Bug 17809: FR installer: fix duplicate authorised value qualif 370

Monteur vs Réalisateur

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ca50623a6082c0aec51d817bd8fddfdb022c8d1b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 17809: Fix ER country appearing twice in fr-FR database files
Fridolin Somers [Thu, 22 Dec 2016 15:03:57 +0000 (16:03 +0100)]
Bug 17809: Fix ER country appearing twice in fr-FR database files

In installer/data/mysql/fr-FR/1-Obligatoire/authorised_values.sql, ER is defined twice, for "Erythrée" (correct one) and "Allemagne".

Test plan :
- Create a new database using fr-FR or import the sql file
- Look at authorised values COUNTRY
=> without patch you have ER / Allemange
=> with patch you have ER / ErythrÃe

NOTE: Allemange occurs twice as well, correctly with DE.
      This patch correctly removes the ER one.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 016c51f3a444e50029a7053c28c6f0821d204605)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 17809: Correct authorised values for fr-FR
Mark Tompsett [Tue, 3 Jan 2017 18:02:40 +0000 (13:02 -0500)]
Bug 17809: Correct authorised values for fr-FR

This corrects:
CC -- duplicate, but name not full.
GQ -- duplicate, but only one name correct.
PK -- Poland was mislabelled.

This removes and edits duplicates and corrects PK to PL.

Signed-off-by: Luke Honiss <luke.honiss@gmail.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9b2dbfab9412d8c4e163c3f83241fa621b3a8123)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27331: (bug 27331 follow-up) Fix syntax error in authorised_values.sql for fr-FR
Jonathan Druart [Mon, 4 Jan 2021 13:41:56 +0000 (14:41 +0100)]
Bug 27331: (bug 27331 follow-up) Fix syntax error in authorised_values.sql for fr-FR

ERROR 1064 (42000) at line 724: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '+
+INSERT INTO authorised_values (category, authorised_value, lib) VALUES ('HOLD' at line 1

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 80029ad4725b64bb6197ced5bd867721769b04a6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27317: (Bug 27127 follow-up) fix t/db_dependent/Koha/BackgroundJobs.t
Fridolin Somers [Wed, 30 Dec 2020 14:06:56 +0000 (15:06 +0100)]
Bug 27317: (Bug 27127 follow-up) fix t/db_dependent/Koha/BackgroundJobs.t

Bug 27127 changed  Koha::BackgroundJob->messages to return arrayref instead of array.
This impacts Unit Test t/db_dependent/Koha/BackgroundJobs.t failling on :
  not ok 10 - 10 messages generated

Test plan :
prove t/db_dependent/Koha/BackgroundJobs.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: I fixed the indentation of the test label.
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(cherry picked from commit 5f2414686dbba56ee8140cad55051d7b900cb47d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27055: Fix compatibility with newer Firefox+Selenium version
Victor Grousset/tuxayo [Thu, 19 Nov 2020 12:47:45 +0000 (13:47 +0100)]
Bug 27055: Fix compatibility with newer Firefox+Selenium version

Fix "submit is not a function error"
A submit button should not be named "submit", in this case, it's id.
https://stackoverflow.com/questions/833032/submit-is-not-a-function-error-in-javascript

Fix some uses of get_attribute()

Fix a fail by setting a global implicit_wait_timeout, default value is 0
in our lib. Other libs set it higher which helps to not have to manually
deal with part of the timing issues.

Fix: remove usage of click_when_visible() because it doesn't work with
elements not in the top of the page. Because they are off screen.

Fix: use $driver->quit() in error_handler to not forget an open Firefox.
With the current version, it fills /dev/shm and fails with around 5
Firefox opened.
Also use quit() it at the end of every script.

Fix: filling item fields, to fill only the displayed one (not those
with display:none)

== Test plan ==
1. Update selenium/standalone-firefox to the latest version [1]
2. prove t/db_dependent/selenium/authentication.t
3. It fails with: arguments[0].form.submit is not a function
4. Apply patch
5. Retest
6. Success

[1] In koha-testing-docker you can do it with
docker-compose.yml:
     selenium:
-        image: selenium/standalone-firefox:2.53.1-americium
+        image: selenium/standalone-firefox

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3c3406257e78a9407320d22820807f767b4c4df3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27250: Fix stacked event listeners in SMTP delete modal
Tomas Cohen Arazi [Thu, 17 Dec 2020 14:53:16 +0000 (11:53 -0300)]
Bug 27250: Fix stacked event listeners in SMTP delete modal

There is a design issue on the click event listener that makes the modal
get added new event listeners on each row being deleted. This makes the
page call all the event listeners and generates an error.

This patch replaces the flawed logic (adding the event listener inside
the event listener). It makes the event listener be defined at startup
time, and make the .on('click') action just pass information around as
required.

To test:
1. Create at least 2 SMTP servers
2. Open the browser inspector, on the network tab
3. Click "Delete" for server 1
=> SUCCESS: You get a successful message (OK)
4. Click "Delete" for server 2
=> SUCCESS: You get a successful message (OK)
=> FAIL: You get also an alert message about server 1 (KO)
=> FAIL: The inspector shows more than one AJAX call has been made
5. Apply this patch and reload the page
6. Repeat 3-4
=> SUCCESS: Everything goes smooth this time
7. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 084d64b84a536c1d88f2fa477865134f97388489)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27099: Stage for import button not showing up
Owen Leonard [Mon, 14 Dec 2020 12:30:03 +0000 (12:30 +0000)]
Bug 27099: Stage for import button not showing up

In the latest version of Chrome, pages where the Humansmg library is
included have a problem where the language footer obscures the bottom of
the page.

The problem traces back to some CSS in the Humanmsg library's CSS file:

html, body {
    height: 100%; /* Damn you IE! */
}

Removing the line doesn't have any ill effects that I can see in Chrome
or Firefox, and it fixes the problem in Chrome. IE can be damned.

To test you must have one or more translations enabled in the staff
interface.

- Apply the patch and clear your browser cache if necessary.
- View pages in the staff interface which use the Humansmg library,
  e.g.:
  - Administration -> System preferences. Choose a category of
    preferences which will be numerous enough to require scrolling to
    reach the bottom of the page.
  - Tools -> Stage MARC records for import. Upload a file to display the
    form for staging the import.
  - Cataloging -> Advanced MARC editor

On each page the language footer should not obscure the bottom of the
page.

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>
(cherry picked from commit 2498cdcc88be798b88d6a23bf6e592cff5a80f45)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27247: Re-add highlighting to the quote editor
Jonathan Druart [Wed, 16 Dec 2020 10:32:20 +0000 (11:32 +0100)]
Bug 27247: Re-add highlighting to the quote editor

Caused by
  commmit 247dca306407ac9568344a0a37aca3bbcffc2468
  Bug 23013: Upgrade DataTables in the staff client

which removed

-tr.even.selected td {
-    background-color: #D3D3D3;
-}

There was no more highlighting when trying to delete an imported quote, as there was before
(see screenshot from the manual https://gitlab.com/koha-community/koha-manual/-/blob/master/source/images/tools/qotd/selectfordelete.png)

It was, however, possible to delete imported quotes, you just don't see which ones you are deleting.

Test plan:
1) Create a CSV with two columns first the name, then the quote (I've attached a CSV that I've done for testing purposes)
2) Go to Tools > Edit quotes for the QOTD feature
3) Click 'Import quotes'
4) Click 'Browse' and choose the CSV created earlier
5) Click on the id of a couple of quotes. Notice those lintes are highlighted

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>
(cherry picked from commit eddf09da53b0ad21e2b2649266ca201623372d0c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27230: Display OPAC description for OPAC_SUG
Jonathan Druart [Mon, 14 Dec 2020 13:51:17 +0000 (14:51 +0100)]
Bug 27230: Display OPAC description for OPAC_SUG

The authorised values OPAC_SUG displayed at the OPAC show the staff
description.

Test plan:
1. Create an auth value in opac_sug, with different text for the description and OPAC description.
2. Go to the OPAC and open the purchase suggestion form.
3. Note in the Reason for purchase drop down, the descriptions appear, the text entered in the OPAC description field.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7063f2c4763d7fec870a4c326837b8b64e64004f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26956: Allow guarantor's controls to be set when a guarantee is created
Jonathan Druart [Wed, 2 Dec 2020 09:34:50 +0000 (10:34 +0100)]
Bug 26956: Allow guarantor's controls to be set when a guarantee is created

With AllowStaffToSetCheckoutsVisibilityForGuarantor and
AllowStaffToSetFinesVisibilityForGuarantor set to Allow, one can only see the
controls for these values in the patron record *after* the patron has been saved
with a guarantor. That makes a frustrating 2-step process. We should be able to
set those values regardless of whether or not there is currently a guarantor on
the account.

Test plan:
Create a guarantee and confirm that the 2 options "Show checkouts to
guarantors" and "Show fines to guarantors" are displayed
Select Yes, save
Confirm that the values have been correctly saved

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6a461382ba944a8e9f4a7c4e534dca74745f0f55)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 22243: Fix unescaped apostrophe in Z target
Andrew Isherwood [Thu, 31 Jan 2019 09:40:08 +0000 (09:40 +0000)]
Bug 22243: Fix unescaped apostrophe in Z target

This patch escapes apostrophes in the z39.50 target name prior to them
being embedded in the template.

To test:

- Create a z39.50 target containing an apostrophe in the title
- Note that the Advanced Cataloguer editor does not load
- Apply the patch
- TEST: Note that the Advanced Cataloguer editor does load

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7ffa71fbd1fa0e4b8c036f02b8a73eacbdfac066)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27200: Compiled CSS
Jonathan Druart [Sat, 26 Dec 2020 17:13:57 +0000 (18:13 +0100)]
Bug 27200: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 28423fa756439607fbbe72d70806e964098345a6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27200: (follow-up) Browse search interface update
Owen Leonard [Wed, 16 Dec 2020 18:38:11 +0000 (18:38 +0000)]
Bug 27200: (follow-up) Browse search interface update

This patch updates the browse search interface to confirm to new
interface patterns in the Bootstrap 4 framework, especially in the form
markup.

The results list has been changed to a Bootstrap "Collapse" component
configured as an accordion
(https://getbootstrap.com/docs/4.5/components/collapse/#accordion-example).

Instead of loading the bibliographic record results below the list of
terms returned, the bibliographic results are now displayed in the
"panel" expanded below the selected term. Subtitle has been added to the
information displayed about the bibliographic record.

To test you must be using ElasticSearch and the OpacBrowseSearch
preference must be enabled. Apply the patch and rebuild the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Open the "Browse search" page in the OPAC.
- Test various searches: Author, Subject, and Title.
- When results are found, the should be displayed as a Bootstrap-styled
  accordion widget. Clicking any individual result should expand the
  panel containing the corresponding records.
- Clicking the record link should open the bibliographic detail page in
  a new window.
- When no results are found, a Bootstrap-style "alert" box should
  appear.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e12e0ef016247003a7a97916aa760277b56782cf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27200: (bug 20168 follow-up) Fix 'Browse search'
Jonathan Druart [Fri, 11 Dec 2020 10:19:55 +0000 (11:19 +0100)]
Bug 27200: (bug 20168 follow-up) Fix 'Browse search'

The 'hidden' class has been replaced by 'd-none' on bug 20168

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fc2c86ba78420a083cfad726b15ed52f9cd19d53)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27196: Don't explode if item that is waiting if checked in by SIP
Jonathan Druart [Mon, 14 Dec 2020 14:54:54 +0000 (15:54 +0100)]
Bug 27196: Don't explode if item that is waiting if checked in by SIP

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6b9b7d8e779b29ec5bb9ec2a2e84c91eb1c5b19e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24398: (QA follow-up) Add POD
Nick Clemens [Mon, 21 Dec 2020 13:43:21 +0000 (13:43 +0000)]
Bug 24398: (QA follow-up) Add POD

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit dd36b9bb5b05e66f01ecd32d028247894820523c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24398: Fix 500 when viewing a single news item at the OPAC
Jonathan Druart [Thu, 10 Dec 2020 14:10:10 +0000 (15:10 +0100)]
Bug 24398: Fix 500 when viewing a single news item at the OPAC

Test plan:
0. Set the NewsAuthorDisplay preference to 'OPAC' or 'Both OPAC and staff client.'
1. Open the OPAC main page and click on an individual news item
Without this patch you get an ugly 500
    Template process failed: undef error - The method Koha::NewsItem->author_title is not covered by tests!
With this patch applied you see the news with the author's info

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c596f450d96e04befe6d5335d8ad12679541d220)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27256: Update click handler for point of sale
Martin Renvoize [Wed, 16 Dec 2020 19:26:11 +0000 (19:26 +0000)]
Bug 27256: Update click handler for point of sale

This patch updates the click handler to bind to the table element in the
DOM as aposed to the individual buttons by their classes. We then use
the event propogation and filter on the button class to catch the clicks
we want.

Test plan
1/ Add 22 debit_types that can be sold to the system (or reduce the
datatable paging size)
2/ Confirm that items on the second page of results cannot be added for
sale on the point of sale page.
3/ Apply the patch
4/ Confirm items from the second table page can now be added correctly
5/ Clicking add when navigating to such an item should leave the items
table unmodified.
6/ Clicking aa when the table was filtered should reset the filters
bringing the table back to the first page
7/ Signoff

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
(cherry picked from commit 68047132a4888db6eb5169e1cd3ceac49aa84b3b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27148: (QA follow-up) Calculate default_strong_password correctly
Nick Clemens [Mon, 21 Dec 2020 16:06:35 +0000 (16:06 +0000)]
Bug 27148: (QA follow-up) Calculate default_strong_password correctly

Fix a typo lenght for length

If category strong password is not set, then we fall back to the preference, but that can be "" - which should be treated as 0

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3b56076405bd0d171b702a63564339d80fa99359)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27148: (follow-up) Fix require_strong variable set
Agustin Moyano [Wed, 9 Dec 2020 18:17:15 +0000 (15:17 -0300)]
Bug 27148: (follow-up) Fix require_strong variable set

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 03839d40b1fd58a3863a1153a6ae44d1002d9afb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27148: Fix bug on self registration when user category is hidden
Agustin Moyano [Thu, 3 Dec 2020 16:10:18 +0000 (13:10 -0300)]
Bug 27148: Fix bug on self registration when user category is hidden

This patch fixes the bug when there is no patron category available for
selection in self registration form. It uses PatronSelfRegistrationDefaultCategory
to get patron's password length and strength.

To test:
1. Do not apply this patch
2. Allow SeflRegistration, set PatronSelfRegistrationDefaultCategory to
   a valid patron category and finally add categorycode to PatronSelfRegistrationBorrowerUnwantedField
3. Go to opac and enter self registration form
CHECK => There is no patron category available for selection
      => Password's info alert shows "Password must contain at least
undefined characters"
4. Fill the form setting a password and send.
CHECH => You get an exception saying "You must provide a patron's
category to validate password's strength and length"
5. Apply this patch and restart_all
6. repeat steps 3 and 4
SUCCESS => Password's info alert message shows a number instead of
"undefined"
        => Password's strength and length checks are working
        => If you change default category's lenght or strength parameter it get's reflected when you refresh the page
        => When you click send, patron is saved

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>
(cherry picked from commit f5373b7a5ea125f5b3123ab038a727d13315390f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 14564: Set permissions on configuration backups
Mirko Tietgen [Sun, 19 Jul 2015 15:16:12 +0000 (17:16 +0200)]
Bug 14564: Set permissions on configuration backups

This patch sets the group and group read permissions on
configuration backups, so that they can be downloaded
via the web staff interface.

Test plan:
0. Apply the patch
1. cp debian/scripts/koha-dump /usr/sbin/koha-dump
2. koha-run-backups --days 2 --output /var/spool/koha
3. Note *.tar.gz backups in /var/spool/koha/kohadev
now have root:kohadev-koha ownership and 640 permissions
4. vi /etc/koha/sites/kohadev/koha-conf.xml
5. Set backup_db_via_tools and backup_conf_via_tools to 1
6. echo 'flush_all' | nc -q 1 memcached 1121
7. koha-plack --restart kohadev
8. Go to http://localhost:8081/cgi-bin/koha/tools/export.pl
9. Click on "Export configuration"
10. Choose a file
11. Click Download configuration
12. Note that *.tar.gz file downloaded correctly

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6982680ae9e71d5d038e894842125860fcc986d6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>