]> git.koha-community.org Git - koha.git/log
koha.git
3 years agoBug 26471: Remove invalid Map URL
Jonathan Druart [Tue, 9 Feb 2021 15:20:36 +0000 (16:20 +0100)]
Bug 26471: Remove invalid Map URL

There is a warning in the console:
Error en el mapeo fuente: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
URL del recurso: http://kohadev-intra.mydnsname.org:8081/intranet-tmpl/lib/datatables/datatables.min_20.1200011.js
URL del mapa fuente: pdfmake.min.js.map

https://developer.mozilla.org/en-US/docs/Tools/Debugger/Source_map_errors

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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24154: Adjust assignment
Nick Clemens [Wed, 5 May 2021 18:41:47 +0000 (18:41 +0000)]
Bug 24154: Adjust assignment

The code seems to work either way
We have a mix in our code:
git grep "}) %]"

Using '=>' over '=' does look nicer

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24154: (follow-up) Make parameter and variable more explicit, add tests
Nick Clemens [Fri, 23 Apr 2021 10:34:06 +0000 (10:34 +0000)]
Bug 24154: (follow-up) Make parameter and variable more explicit, add tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24154: Get rules rather than values to determine if set or not
Nick Clemens [Fri, 16 Apr 2021 16:59:44 +0000 (16:59 +0000)]
Bug 24154: Get rules rather than values to determine if set or not

Template plugin CirculationRules.Search returns "" if a rule doesn't
exist or if the rule exists but is set to ""

To get more info, we add a 'want_rule' parameter and use that to test
if defined but blank

To test:
1 - In circulation rules set the 'Default checkout, hold and return
    policy' without setting values
2 - Unset it
3 - Notice there is no visual difference
4 - Apply patch
5 - Reload the page
6 - note there is no 'Unset button' and first column says 'Not set'
7 - Save the rule with no values
8 - Now 'Defaults' is displayed and the unset button exists

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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24564: Use the same tab as the other subfields within a field
Julian Maurice [Thu, 1 Apr 2021 09:04:35 +0000 (11:04 +0200)]
Bug 24564: Use the same tab as the other subfields within a field

For each subfield added, we check if other subfields exists in the same
field. If that's the case we use the same tab as the first subfield
found.

Test plan:
1. Find a biblio subfield in
   misc/migration_tools/ifla/data/biblio/default.yml that doesn't exist
   in your default biblio MARC framework (or delete one). The field
   should exist and have other subfields with a tab set.
2. Change the tab of all subfields within that field it's different from
   what's in the .yml file
3. Run misc/migration_tools/ifla/update.pl
4. Verify that the subfield has been added and have the same tab as
   others subfields
5. Do the same for authorities (files are in
   misc/migration_tools/ifla/data/auth/)

Signed-off-by: Koha team <koha@univ-lyon.fr>
Signed-off-by: sonia <sonia.bouis@univ-lyon3.fr>
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24564: Do not modify the tab of existing subfield in ifla/update.pl
Julian Maurice [Wed, 31 Mar 2021 08:44:48 +0000 (10:44 +0200)]
Bug 24564: Do not modify the tab of existing subfield in ifla/update.pl

Test plan:
1. Find a biblio subfield in
   misc/migration_tools/ifla/data/biblio/default.yml that you have in
   your default biblio MARC framework (or create one).
2. Change the tab of this subfield so that it's different from what's in
   the .yml file
3. Run misc/migration_tools/ifla/update.pl --force
4. Verify that the tab of this subfield has not been changed.
5. Do the same for authorities (files are in
   misc/migration_tools/ifla/data/auth/)

Signed-off-by: sonia <sonia.bouis@univ-lyon3.fr>
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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27756: Fork background jobs to prevent memory leak
Jonathan Druart [Tue, 2 Mar 2021 10:22:29 +0000 (11:22 +0100)]
Bug 27756: Fork background jobs to prevent memory leak

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23215: DBRev 20.12.00.047
Jonathan Druart [Fri, 7 May 2021 12:38:35 +0000 (12:38 +0000)]
Bug 23215: DBRev 20.12.00.047

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23215: Remove traces of the PayPal feature
Tomas Cohen Arazi [Wed, 5 May 2021 13:16:50 +0000 (10:16 -0300)]
Bug 23215: Remove traces of the PayPal feature

This patch removes the PayPal payments feature. It has been moved to
its' own plugin.

To test:
1. Apply this patches
2. Run:
   $ updatedatabase
=> SUCCESS: Database updates correctly
3. Run:
   $ koha-mysql kohadev
   > SELECT * FROM systempreferences WHERE variable LIKE 'paypal';
=> SUCCESS: No results
4. On the sysprefs, OPAC section
=> SUCCESS: No PayPal-related sysprefs show up
5. Add some charges to your patron
6. In the OPAC, log in and see your charges
=> SUCCESS: Nothing broken
7. Install the PayPal plugin [1] or any other payment plugin
8. Restart plack (mandatory for the PayPal plugin)
9. Set some random data in the config (or better, real sandbox testing
   data)
10. Go to the OPAC's account page and try to pay your debts (use the
    checkbox to select lines)
=> SUCCESS: The PayPal payment method shows, you can click the button,
    it fails due to bad config, but things work as expected.
11. Sign off :-D

[1] https://gitlab.com/thekesolutions/plugins/koha-plugin-pay-via-paypal/-/releases

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23215: Remove PayPal-related sysprefs
Tomas Cohen Arazi [Wed, 5 May 2021 13:16:18 +0000 (10:16 -0300)]
Bug 23215: Remove PayPal-related sysprefs

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28291: Make koha-translate script produce valid UTF-8 YAML files
Joonas Kylmälä [Wed, 5 May 2021 14:20:38 +0000 (17:20 +0300)]
Bug 28291: Make koha-translate script produce valid UTF-8 YAML files

We had two problems in the LangInstaller.pm module:
 1) the PO file was read as bytes instead of as a UTF-8 text stream
 2) The YAML file being outputted was double encoded, once by setting
    the file handle to output UTF-8 and other time in the DumpFile
    function internally

To test:
1. Before applying patch do the following
$ cd misc/translator
$ ./translate update pl-PL
$ ./translate install pl-PL
$ cd -
$ less installer/data/mysql/pl-PL/marcflavour/marc21/mandatory/authorities_normal_marc21.yml
2. Notice the output of the authorities_normal_marc21.yml contains
invalid looking UTF-8 characters
3. $ git clean -d -f # to remove the old translation files
4. Apply patch and repeat the steps and notice the
authorities_normal_marc21.yml contains valid looking UTF-8 characters

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 28281: Add tests
Jonathan Druart [Wed, 5 May 2021 09:50:16 +0000 (11:50 +0200)]
Bug 28281: Add tests

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 28281: Remove double decoding when importing installation data
Joonas Kylmälä [Wed, 5 May 2021 09:12:44 +0000 (12:12 +0300)]
Bug 28281: Remove double decoding when importing installation data

The YAML::XS::Load and YAML::XS::LoadFile functions already decode the
YAML to Perl objects/strings, therefore decoding the output yet
another time is not needed and causes an error to happen.

To test:

1. Go through the following steps and notice without this patch the
error happens and with this patch it doesn't:

$ koha-mysql kohadev < installer/data/mysql/kohastructure.sql
$ restart_all
$ ./translate update pl-PL
$ ./translate install pl-PL
$ restart_all
 --> Go to the Koha web installer page and select pl-PL as the installer
 language, click through it and notice it gives following error at the
 MARC21 step:

 Cannot decode string with wide characters at /usr/lib/x86_64-linux-gnu/perl/5.24/Encode.pm line 202

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 28298: fix DB update 19.12.00.076
Alex Arnaud [Fri, 7 May 2021 07:58:09 +0000 (09:58 +0200)]
Bug 28298: fix DB update 19.12.00.076

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: (follow-up) don't display "Copy link[...]" when not possible
Victor Grousset/tuxayo [Mon, 3 May 2021 20:42:15 +0000 (22:42 +0200)]
Bug 27594: (follow-up) don't display "Copy link[...]" when not possible

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: (follow-up) Check for secure context
Owen Leonard [Fri, 9 Apr 2021 15:44:28 +0000 (15:44 +0000)]
Bug 27594: (follow-up) Check for secure context

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: (QA follow-up): Display message only if copy worked
Victor Grousset/tuxayo [Tue, 6 Apr 2021 18:10:22 +0000 (20:10 +0200)]
Bug 27594: (QA follow-up): Display message only if copy worked

And check if writeText is available.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27594: Add access to public download link for publicly-accessible uploads
Owen Leonard [Tue, 2 Feb 2021 14:10:49 +0000 (14:10 +0000)]
Bug 27594: Add access to public download link for publicly-accessible uploads

This patch adds a link to the display of publicly-accessible uploads so
that the user can copy the public link. This will hopefully lead to
easier use of sound file uploads in the Audio Alerts system.

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

- If necessary, upload a file with the "Allow public downloads"
  checkbox checked.
- Upon upload you should be shown the results of your upload in a table
  with the file details.
- In the "Public" column you should see that "Yes" is a link.
  - When you hover your mouse over the link you should see a tooltip,
    "Copy link to this file."
  - When you click the link the tooltip should say "Link copied to the
    clipboard."
  - Verify that the correct link has been copied.
- Test uploading a file which is not publicly-accessible.
  - Confirm that the information in the "Public" column says "No" and is
    not a link.

Signed-off-by: David Nind <david@davidnind.com>
Bug 27594: (QA follow-up): Use clipboard API

While the Clipboard API doesn't
have 100% coverage (https://www.caniuse.com/?search=clipboard), it has
enough coverage for the "copy" operation that it can be counted on for
use in the staff interface.

This patch removes the global copyToClipboard function and replaces it
with a call to ndavigator.clipboard.writeText() in the template.

To test, follow the previous test plan and confirm that the public
download link is still copied correctly to the clipboard.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27793: Store FTX free text in vendor note
Colin Campbell [Thu, 25 Feb 2021 10:59:24 +0000 (10:59 +0000)]
Bug 27793: Store FTX free text in vendor note

This is important for proquest ordering to distinguish types of
material.

FTX segment from quote is stored as vendor note.
Contents of vendornote are included in the order FTX segment.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28278: Uncomment and test access_dirs
Jonathan Druart [Fri, 7 May 2021 09:31:21 +0000 (11:31 +0200)]
Bug 28278: Uncomment and test access_dirs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28278: Improve $KOHA_CONF parsing speed by using XML::LibXML
Julian Maurice [Fri, 30 Apr 2021 15:13:48 +0000 (17:13 +0200)]
Bug 28278: Improve $KOHA_CONF parsing speed by using XML::LibXML

- Without the patch:

$ hyperfine --warmup 1 \
  'perl -MKoha::Config -e "Koha::Config->read_from_file(\$ENV{KOHA_CONF}) for (1..1000)"'

  Time (mean ± σ):      3.585 s ±  0.018 s    [User: 3.531 s, System: 0.049 s]
  Range (min … max):    3.547 s …  3.612 s    10 runs

- With the patch:

$ hyperfine --warmup 1 \
  'perl -MKoha::Config -e "Koha::Config->read_from_file(\$ENV{KOHA_CONF}) for (1..1000)"'

  Time (mean ± σ):      1.122 s ±  0.028 s    [User: 1.104 s, System: 0.014 s]
  Range (min … max):    1.095 s …  1.189 s    10 runs

Test plan:
1. Apply the first patch (the one with the unit tests) and make sure
   tests pass: `prove t/Koha/Config.t`
2. Apply the rest of the patches and verify that tests still pass:
   `prove t/Koha/Config.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>
3 years agoBug 28278: Add unit test for Koha::Config::read_from_file
Julian Maurice [Fri, 30 Apr 2021 15:11:14 +0000 (17:11 +0200)]
Bug 28278: Add unit test for Koha::Config::read_from_file

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>
3 years agoBug 27584: Refactor OAI-PMH paging to improve performance
Ere Maijala [Mon, 1 Feb 2021 11:25:04 +0000 (13:25 +0200)]
Bug 27584: Refactor OAI-PMH paging to improve performance

Includes the following optimizations:
- Use next biblionumber instead of large offset in the queries.
- Use unions instead of subqueries
- Avoid fetching item timestamps when items are not included.

Test plan:

1. Without the patch, try harvesting a Koha database with (and without for good measure) `include_items: 1` in the OAI-PMH configuration file pointed to by preference OAI-PMH:ConfFile and take note of performance. For useful metrics the database must be large enough to not fit in InnoDB buffers or OS file cache.
2. Apply the patch.
3. Run tests: prove -v t/db_dependent/OAI
4. Try again the harvesting from step 1 and compare performance with step 1.

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>
3 years agoBug 14723: DBIC schema changes
Jonathan Druart [Fri, 7 May 2021 12:17:00 +0000 (14:17 +0200)]
Bug 14723: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: DBRev 20.12.00.046
Jonathan Druart [Fri, 7 May 2021 11:46:52 +0000 (11:46 +0000)]
Bug 14723: DBRev 20.12.00.046

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Make DB rev idempotent
Jonathan Druart [Fri, 7 May 2021 09:49:40 +0000 (11:49 +0200)]
Bug 14723: Make DB rev idempotent

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Use DATETIME instead DATE
Emmi Takkinen [Mon, 3 May 2021 07:37:02 +0000 (10:37 +0300)]
Bug 14723: Use DATETIME instead DATE

Letters.t tests failed since time_queued didn't
include timecode. Use DATETIME when inserting
into message_queue.

To test prove t/db_dependent/Letters.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: (QA follow-up) Fix typo
Kyle M Hall [Thu, 29 Apr 2021 13:48:12 +0000 (09:48 -0400)]
Bug 14723: (QA follow-up) Fix typo

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Add error codes and replace strings with them in template
Emmi Takkinen [Wed, 28 Apr 2021 05:55:02 +0000 (08:55 +0300)]
Bug 14723: Add error codes and replace strings with them in template

This patch adds error codes for delivery notes and replaces English
strings with them in template.

To test confirm everything works as intended.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Make delivery notes translatable
Emmi Takkinen [Thu, 14 May 2020 09:32:13 +0000 (12:32 +0300)]
Bug 14723: Make delivery notes translatable

Delivery notes weren't translatable. This patch adds
them in notices.tt. If note is Mail::Sendmail error generic
'Error occured while sending email' is shown.

Also fixes MySQLisms and adds AFTER to atomicupdate file.

To test prove t/db_dependent/Letters.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 14723: Additional delivery notes to messages
Lari Taskula [Wed, 12 Apr 2017 11:14:44 +0000 (11:14 +0000)]
Bug 14723: Additional delivery notes to messages

This patch adds additional delivery notes to messages in message queue as there
can be multiple reasons for a delivery to fail.

Currently in message_queue we are given only two delivery statuses for messages,
"sent" and "failed". When the status becomes failed, we have no idea why it fails.

This feature can be useful with SMS gateway providers. Many SMS gateways inform
the application the reason of SMS delivery failure. With this feature, this
information can now be stored. As well as for emails, instead of simply logging
failures, we can now store the reason of failure directly into the message row
of message_queue.

Test plan:

1. Enable EnhancedMessagingPreferences syspref
2. Find a borrower with notices at members/notices.pl
3. Observe that there is no column for Delivery notes
4. Apply patch and run the given database update
5. Repeat step 1.
6. Observe that there is now a column for Delivery notes

Sponsored-by: Hypernova Oy
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: DBRev 20.12.00.045
Jonathan Druart [Fri, 7 May 2021 11:46:52 +0000 (11:46 +0000)]
Bug 21249: DBRev 20.12.00.045

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 21249: (follow-up) Adding parentheses to fix query
Aleisha Amohia [Wed, 5 May 2021 05:22:06 +0000 (17:22 +1200)]
Bug 21249: (follow-up) Adding parentheses to fix query

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>
3 years agoBug 21249: (follow-up) Implement SearchLibraryLimit for individual library
Aleisha Amohia [Tue, 23 Feb 2021 21:48:10 +0000 (10:48 +1300)]
Bug 21249: (follow-up) Implement SearchLibraryLimit for individual library

before this patch, the limit only applies to groups of libraries

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>
3 years agoBug 21249: (follow-up) Fixing syspref name, description, get working with OPAC masthe...
Aleisha Amohia [Tue, 21 Apr 2020 11:48:06 +0000 (11:48 +0000)]
Bug 21249: (follow-up) Fixing syspref name, description, get working with OPAC masthead search

Syspref is now called SearchLimitLibrary, and the description better
explains what the feature does. It works with the advanced search on the
staff client and OPAC, and the masthead search on the OPAC when
OpacAddMastheadLibraryPulldown is enabled.

Sponsored-by: Catalyst IT
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>
3 years agoBug 21249: Code cleaning
Jonathan Druart [Wed, 6 Nov 2019 11:19:11 +0000 (12:19 +0100)]
Bug 21249: Code cleaning

Trying to make the code a bit more readable removing unecessary
variables and parenthesis.

Code is duplicated but no idea where we could move it to.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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>
3 years agoBug 21249: Made the SQL INSERT statement idempotent
Alex Buckley [Thu, 27 Dec 2018 01:44:22 +0000 (01:44 +0000)]
Bug 21249: Made the SQL INSERT statement idempotent

Sponsored-BY: Brimbank Library, Australia

Signed-off-by: Amandine Zocca <azocca@ville-montauban.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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>
3 years agoBug 21249: New syspref controlling branch fields queried against selected library...
Alex Buckley [Mon, 20 Aug 2018 09:49:43 +0000 (21:49 +1200)]
Bug 21249: New syspref controlling branch fields queried against selected library group value in advanced search

This commit allows librarians to choose whether they want to query the
homebranch, holdingbranch or homebranch AND holdingbranch when they set
a library or library group search condition in the staff client and OPAC
advanced searches.

Test plan:
1. Apply patches, update database, restart services
2. Set up a record with one item. Edit the item so that:
home branch = Branch A
holding/current branch = Branch B.
Note the barcode of your item.
3. Go to Administration -> Library Groups. Create a library group that
only contains Branch A.

= homebranch and holdingbranch =

4. Go to Administration -> System preferences and find the new
SearchLimitLibrary syspref. Confirm it is set to 'homebranch and
holdingbranch' by default. Keep this tab open.
5. Go to Advanced Search in the staff client in another tab. Under 'location and
availability', select your library group from the dropdown. Under
'search for', select the barcode option and enter your item's barcode.
6. Submit the search and confirm you are taken to your item as expected.
7. Go back to Advanced Search. Under 'location and availability', select
Branch A from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
8. Submit the search and confirm you are taken to your item as expected.
9. Go back to Advanced Search. Under 'location and availability', select
Branch B from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
10. Submit the search and confirm you are taken to your item as expected.

= homebranch only =

11. Go back to your System preferences tab. Set the SearchLimitLibrary
syspref to 'homebranch'. keep this tab open.
12. Go to Advanced Search in the staff client in another tab. Under 'location and
availability', select your library group from the dropdown. Under
'search for', select the barcode option and enter your item's barcode.
13. Submit the search and confirm you are taken to your item as expected,
because the syspref is set to homebranch and the library group contains our item's
homebranch.
14. Go back to Advanced Search. Under 'location and availability', select
Branch A from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
15. Submit the search and confirm you are taken to your item as expected.
16. Go back to Advanced Search. Under 'location and availability', select
Branch B from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
17. Submit the search and confirm you are NOT taken to your item and your item
does not show in the search results.

= holdingbranch only =

18. Go back to your System preferences tab. Set the SearchLimitLibrary
syspref to 'holdingbranch'. keep this tab open.
19. Go to Advanced Search in the staff client in another tab. Under 'location and
availability', select your library group from the dropdown. Under
'search for', select the barcode option and enter your item's barcode.
20. Submit the search and confirm you are NOT taken to your item and your
item does not show in the search results, because the syspref is set to
holdingbranch and the library group does not contain our item's holdingbranch.
21. Go back to Advanced Search. Under 'location and availability', select
Branch B from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
22. Submit the search and confirm you are taken to your item as expected.
23. Go back to Advanced Search. Under 'location and availability', select
Branch A from the individual libraries dropdown. Under 'search for',
select the barcode option and enter your item's barcode.
24. Submit the search and confirm you are NOT taken to your item and your item
does not show in the search results.

25. Repeat the above test plan but do your searching with the OPAC
advanced search.

Sponsored-By: Brimbank Library
Signed-off-by: Amandine Zocca <azocca@ville-montauban.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
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>
3 years agoBug 16486: Display the timestamp when an accountline is updated
Aleisha Amohia [Tue, 21 Apr 2020 05:15:25 +0000 (05:15 +0000)]
Bug 16486: Display the timestamp when an accountline is updated

This patch updates the Date field to be 'Created' and adds a new column
'Updated' which shows the timestamp of the accountline.

To test:
1) Apply patch, restart services
2) Test the following staff client pages:
- Reports -> Cash register
- Patron Accounting tab -> Transactions
- Create a manual invoice. Click 'Print' on the transactions tab to
generate Invoice slip
- Make a payment. Click 'Print' on the transactions tab to generate
Receipt slip
3) Test the OPAC:
- your charges

Sponsored-by: Catalyst IT
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27577: Autolink biblio after biblionumber is generated
Nick Clemens [Fri, 29 Jan 2021 13:33:34 +0000 (13:33 +0000)]
Bug 27577: Autolink biblio after biblionumber is generated

If BiblioAddsAuthorities and AutoCreateAuthorities are enabled, a new record is auto linked when saving and authorities generated with a 670 field that indicates which record generated the new authority.

The code to do this is called before the biblionumber is generated, so the variable that adds the biblionumber to the citation is empty

This patch moves the linking code to after the biblionumber is generated

To recreate:
1 - Enable BiblioAddsAuthorities and AutoCreateAuthorities
2 - Import or create a new record
3 - Ensure the record has controlled fields that do not have authorities before saving, i.e.:
    Add a 650 with "test_bug_27577_01"
4 - Search for the authority record
5 - Note the 670 field does not contain the biblionumber
6 - Apply patch, restart all the things
7 - Repeat 2-4
8 - Note the 670 now has the biblionumber

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.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 27577: Unit test
Nick Clemens [Wed, 5 May 2021 18:20:05 +0000 (18:20 +0000)]
Bug 27577: Unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28288: Prevent XSISBN.t to fail if service is returning 500
Jonathan Druart [Tue, 4 May 2021 14:38:27 +0000 (16:38 +0200)]
Bug 28288: Prevent XSISBN.t to fail if service is returning 500

16:00:45 koha_1       | WARNING: URL Request Failed 500 read timeout
16:00:45 koha_1       | WARNING: URL Request Failed 500 read timeout
16:00:45 koha_1       | WARNING: URL Request Failed 500 Can't connect to www.librarything.com:443
16:00:45 koha_1       | # Looks like you planned 6 tests but ran 5.
16:00:45 koha_1       | [13:59:51] t/db_dependent/XISBN.t
16:00:45 koha_1       | Dubious, test returned 255 (wstat 65280, 0xff00)
16:00:45 koha_1       | Failed 1/6 subtests
16:00:45 koha_1       |  (less 3 skipped subtests: 2 okay)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: Compiled CSS
Jonathan Druart [Tue, 4 May 2021 13:24:02 +0000 (15:24 +0200)]
Bug 27740: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (follow-up) changed "User summary" css
Henry Bolshaw [Wed, 21 Apr 2021 15:16:49 +0000 (15:16 +0000)]
Bug 27740: (follow-up) changed "User summary" css

Changed user summary CSS to style H2 not H3 heading

To test:
1) Go to OPAC homepage
2) Login as a user with at least one loan
3) See that the "User summary" heading is not styled
4) Apply patch
5) Run yarn build --view OPAC
6) Confirm the heading is now styled with grey background

Signed-off-by: Wainui Witika-Park <wainuiwitikapark@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 27740: (follow-up) Added User summary heading
Wainui Witika-Park [Sun, 18 Apr 2021 07:56:55 +0000 (07:56 +0000)]
Bug 27740: (follow-up) Added User summary heading

Added a User summary <h2>

To test:
1) Go to OPAC
2) Go to home page
3) Check that there is a <h2> saying "User summary"

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (follow-up) quote of the day to <h2>
Wainui Witika-Park [Fri, 16 Apr 2021 03:19:13 +0000 (03:19 +0000)]
Bug 27740: (follow-up) quote of the day to <h2>

If the quote of the day feature is enabled, a "Quote of the day" heading
is displayed. It was an <h3> which was not proper hierarchy, so this has
been changed to an <h2>.

To test:
1) Go to staff client
2) Enable quote of the day preference
3) Go to the OPAC
4) Observe "Quote of the day" heading
5) Ensure it is an <h2>

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (follow-up) changed welcome user to <p>
Wainui Witika-Park [Fri, 16 Apr 2021 03:08:21 +0000 (03:08 +0000)]
Bug 27740: (follow-up) changed welcome user to <p>

In the 'user_summary block', the "Welcome, user" was an <h3>. This has
been changed to a <p> as it isn't really a heading.

The styling can be changed to make it appear as it was before, or to
make it appear more significant on the page.

To test:
1) Go to the OPAC
2) Go to the home page
3) Go to the 'user_summary' block
4) Check that the part where is says "Welcome, user" is now a <p>

Sponsored-by: Catalyst IT
Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27740: (QA follow-up) Fix 'Your purchase suggestions'
Martin Renvoize [Thu, 15 Apr 2021 14:38:16 +0000 (15:38 +0100)]
Bug 27740: (QA follow-up) Fix 'Your purchase suggestions'

On the purchase suggestions page you could end up with two "Your
purchase suggestions" headings, one as an h1 and one as an h2..

Test plan
1/ Add at least one purchage suggestion to a patron
2/ Navigate to 'Purchase suggestions'
3/ Note that just one 'Your purchase suggestsions' heading appears with
a top level '1'.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@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 27740: (QA follow-up) Fix 'Payment method'
Martin Renvoize [Thu, 15 Apr 2021 14:00:52 +0000 (15:00 +0100)]
Bug 27740: (QA follow-up) Fix 'Payment method'

The 'Payment method' heading now needs to be moved to the second level
to ensure consistent header heirarchy.

Test plan
1/ Add some debts to a patrons account
2/ Enable online payments (Paypal is a good example)
3/ Login to the OPAC and navigate to the 'Charges' page
4/ Note the header hierarchy has no gaps... (h1 -> h2, not h1 -> h3)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@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 27740: Corrected tags & hierarchy of headings
Wainui Witika-Park [Thu, 25 Mar 2021 23:49:20 +0000 (23:49 +0000)]
Bug 27740: Corrected tags & hierarchy of headings

Bug 27610 corrected the <h1> tags in each of the OPAC files. This patch
corrects the hierarchy of the rest of the headings on each of the pages.

To test:
1) Go to the OPAC
2) Apply Bug 27610 patch
3) Apply patch (Bug 27740)
4) Go to each of the pages and check that the headings under <h1> are in
   the correct order and hierarchy

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28134: Replace use of input type number in onboarding templates
Owen Leonard [Mon, 12 Apr 2021 10:49:45 +0000 (10:49 +0000)]
Bug 28134: Replace use of input type number in onboarding templates

This patch changes the instances of input of type="number" to input
type="text" with attributes inputmode="numeric" and pattern="[0-9]*"

To test, apply the patch and run through the process of installing Koha.
When you reach onboarding step 2, "Create a patron category," check the
enrollment period -> "In months" field. The field should not accept any
input except numbers.

Continue onboarding until step 5, "Create a new circulation rule." On
this page, check that these fields accept only numbers:

 - Current checkouts allowed
 - Loan period
 - Renewals allowed
 - Renewals period
 - Holds allowed (total)
 - Holds allowed (daily)
 - Holds per record (count)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27246: Remove obsolete BEGIN code from C4::Context
Jonathan Druart [Wed, 16 Dec 2020 10:04:48 +0000 (11:04 +0100)]
Bug 27246: Remove obsolete BEGIN code from C4::Context

We don't longer enter the HTTP_USER_AGENT conditional in the BEGIN block
of C4::Context. It was used when apache only was used.

I am suggesting to remove it but keep the $CGI::VERSION < 4.08 condition
to keep support of all version (not sure it's needed but won't hurt).

I have not found a lot of occurrences of KOHA_BACKTRACES and I am
assuming not much people are using it, we should prefer the dev_install
flag instead (to set environment="development" when plack is started and
enabled the starman trace)

Test plan:
Regression test what you think is useful
Confirm the above statements

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27865: Pass the x-koha-override header to PUT /holds/:hold_id from the patron...
Tomas Cohen Arazi [Mon, 8 Mar 2021 17:36:41 +0000 (14:36 -0300)]
Bug 27865: Pass the x-koha-override header to PUT /holds/:hold_id from the patron's page

This patch makes the AJAX call to update an existing hold, pass the
'x-koha-override' header with the value of 'any', so any pickup location
policy override that is needed, is applied.

As the override is taken into account only if AllowHoldPolicyOverride is
enabled, this in fact restores the previous behavior.

To test:
1. Have a patron with a hold
2. Have AllowHoldPolicyOverride set to 'yes'
3. Try changing the pickup location to an invalid one
=> FAIL: The options are the same as before 27205, yet the AJAX call
         fails because of invalid pickup location.
4. Apply this patch
5. Repeat 3
=> SUCCESS: The API call succeeds, and the hold is updated (it is
        actually refetch, so just verify it has the value you selected
6. Sign off :-D

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Add missing tests for PUT and POST
Jonathan Druart [Tue, 4 May 2021 13:04:17 +0000 (15:04 +0200)]
Bug 28254: Add missing tests for PUT and POST

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Simplify tests
Jonathan Druart [Tue, 4 May 2021 12:56:24 +0000 (14:56 +0200)]
Bug 28254: Simplify tests

This is only cosmetic, and maybe personal preferences.
It seems easier to create the library object with the pickup_library we
want to use.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: (QA follow-up) override -> force
Martin Renvoize [Fri, 30 Apr 2021 13:41:43 +0000 (14:41 +0100)]
Bug 28254: (QA follow-up) override -> force

After some discussion we decided that the parameter should be called
'force' for pushign through an action against policy. (as per the
Transfers work).

We decided to stick to 'override' at the API level however as it
highlights the 'human interaction' element of the call.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Make PUT /holds/:hold_id/pickup_location honour x-koha-override
Tomas Cohen Arazi [Wed, 28 Apr 2021 17:56:33 +0000 (14:56 -0300)]
Bug 28254: Make PUT /holds/:hold_id/pickup_location honour x-koha-override

This patch adds a new parameter (x-koha-override header) to the route,
and makes the controller pass this information (override requested) when
the AllowHoldPolicyOverride syspref is set, to
Koha::Hold->set_pickup_location.

This way, under certain conditions, we can be sure the update wont'
fail.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Unit tests
Tomas Cohen Arazi [Wed, 28 Apr 2021 17:55:52 +0000 (14:55 -0300)]
Bug 28254: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28254: Add 'override' parameter to Koha::Hold->set_pickup_location
Tomas Cohen Arazi [Wed, 28 Apr 2021 17:37:12 +0000 (14:37 -0300)]
Bug 28254: Add 'override' parameter to Koha::Hold->set_pickup_location

This patch adds a new parameter to the method. If passed+true it makes
the method skip the pickup validation test.

Tests and POD added for this change.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27898: Make PUT /holds/:hold_id accept overrides
Tomas Cohen Arazi [Mon, 8 Mar 2021 16:05:34 +0000 (13:05 -0300)]
Bug 27898: Make PUT /holds/:hold_id accept overrides

This patch makes the route handle overriding pickup locations by passing
the 'x-koha-override' header (set to 'any').

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail, because things cannot be overridden ATM.
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: 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>
3 years agoBug 27898: Unit tests
Tomas Cohen Arazi [Mon, 8 Mar 2021 16:03:43 +0000 (13:03 -0300)]
Bug 27898: Unit tests

This patch adds unit tests for the PUT /holds/:hold_id route so it
accepts the x-koha-override header and is able to override pickup
location constraints.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
3 years agoBug 27797: (QA follow-up) Pickup locations can be overridden too
Tomas Cohen Arazi [Mon, 8 Mar 2021 15:03:01 +0000 (12:03 -0300)]
Bug 27797: (QA follow-up) Pickup locations can be overridden too

This patch adds regression tests for overridding pickup locations, which
was inadvertedly not covered by the original dev. What this does, is
moving the $can_override variable definition above, and avoid returning
400 if conditions are not met for the passed pickup_library_id, when
$can_override is true.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: (QA follow-up) Make tests more robust
Tomas Cohen Arazi [Mon, 8 Mar 2021 14:43:04 +0000 (11:43 -0300)]
Bug 27797: (QA follow-up) Make tests more robust

This patch makes the tests mock things so the complex holds scenarios
where existing data could interfere, don't get in the middle with what
we need to test.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Nothing broke

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: (follow-up): Remove stray x-koha-override definition
Tomas Cohen Arazi [Mon, 8 Mar 2021 13:25:06 +0000 (10:25 -0300)]
Bug 27797: (follow-up): Remove stray x-koha-override definition

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: (QA follow-up) Additional tests and operator change
Nick Clemens [Thu, 4 Mar 2021 19:50:22 +0000 (19:50 +0000)]
Bug 27797: (QA follow-up) Additional tests and operator change

I added a few tests to cover additional cases and found the operator precedence
was failing, switched 'and' to '&&'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27797: Make POST /holds use the stashed koha.overrides
Tomas Cohen Arazi [Fri, 26 Feb 2021 13:51:52 +0000 (10:51 -0300)]
Bug 27797: Make POST /holds use the stashed koha.overrides

Bug 26181 introduced a way to override behavior through a new header,
x-koha-override. And bug 27760 introduced a generic approach to handle
x-koha-override.

This patchset makes the POST /api/v1/holds route rely on this new way of
handling x-koha-override instead of doing it manually.

The header is added to the spec as a parameter.

Note: the header should be defined as:

    "type": "array",
    "collectionFormat": "csv",
    "items": {
        "type": "string",
        "enum": [
            "any"
        ]
    }

but the versions of JSON::Validator we use have lots of bugs related to
header type coercion, so it just doesn't work. The changelog for
JSON::Validator is fairly elocuent about it.

The override now takes a list of valid keywords (right now only 'any'
but it would be fairly straight-forward to add a fairly granular set of
options based on each possible AddReserve failure.

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

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>
3 years agoBug 27797: Unit tests
Tomas Cohen Arazi [Fri, 26 Feb 2021 13:50:46 +0000 (10:50 -0300)]
Bug 27797: Unit tests

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>
3 years agoBug 27760: (QA follow-up) Improve POD
Tomas Cohen Arazi [Thu, 11 Mar 2021 11:03:13 +0000 (08:03 -0300)]
Bug 27760: (QA follow-up) Improve POD

This patch improves the POD for the added helper, and also adds
references to the JSON::Validator issue that explains the current
implementation. A FIXME is added for when we upgrade our used
JSON::Validator version.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27760: Improve readabiliity using map
Jonathan Druart [Thu, 11 Mar 2021 10:15:26 +0000 (11:15 +0100)]
Bug 27760: Improve readabiliity using map

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27760: Make authenticate_api_request call stash_overrides
Tomas Cohen Arazi [Thu, 25 Feb 2021 12:43:11 +0000 (09:43 -0300)]
Bug 27760: Make authenticate_api_request call stash_overrides

By making this method call the helper, we make sure the overrides
hashref is available to any controller to make us of it.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t \
           t/Koha/REST/Plugin/Query.t
=> SUCCESS: Tests pass! The helper works as expected and the
authenticate_api_request method invokes it!
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27760: Add stash_overrides helper
Tomas Cohen Arazi [Thu, 25 Feb 2021 12:35:28 +0000 (09:35 -0300)]
Bug 27760: Add stash_overrides helper

This patch adds a simple helper that reads the x-koha-override request
header, and processes it to stash a hashref with the passed overrides.

No check on the overrides themselves is done, as they should be
validated using the OpenAPI spec.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27864: (QA follow-up) Select2 style on multi-holds
Tomas Cohen Arazi [Fri, 30 Apr 2021 14:31:13 +0000 (11:31 -0300)]
Bug 27864: (QA follow-up) Select2 style on multi-holds

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27864: (QA follow-up) Hide logged-in option if invalid pickup location
Tomas Cohen Arazi [Fri, 30 Apr 2021 12:55:26 +0000 (09:55 -0300)]
Bug 27864: (QA follow-up) Hide logged-in option if invalid pickup location

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27864: (QA follow-up) Remove size=1 on selects (28066 follow-up)
Tomas Cohen Arazi [Mon, 26 Apr 2021 11:21:41 +0000 (08:21 -0300)]
Bug 27864: (QA follow-up) Remove size=1 on selects (28066 follow-up)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27864: Correct dropdown size
Tomas Cohen Arazi [Mon, 15 Mar 2021 14:36:04 +0000 (11:36 -0300)]
Bug 27864: Correct dropdown size

This patch makes the dropdown width inherit the existing style.

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>
3 years agoBug 27864: Visual feedback on overridden pickup locations when placing hold
Tomas Cohen Arazi [Fri, 12 Mar 2021 21:01:28 +0000 (18:01 -0300)]
Bug 27864: Visual feedback on overridden pickup locations when placing hold

This patch makes the form for placing a hold, use the API to retrieve
the valid pickup locations for a biblio.

To test:
1 - In Circulation and fines rules > Default checkout, hold and return policy, change 'Hold pickup library match' to 'item's home library'
2 - Set AllowHoldPolicyOverride system preference to Allow
3 - Try placing a hold on a biblio with several items.
    Ensure that there is one item with homebranch of the patrons branch and
    one at another branch
4 - Note the pickup location dropdown lists all branches, even those not matching the policy (Item's home library)
5 - FAIL: There's no sign they are overrides to rules
6 - Apply the patch
7 - Repeat 3
8 - SUCCESS: Same behavior as before all libraires listed, but there's a sign
    + tooltip for overridden ones.
9 - Sign off :-D

Note: styling follow-up coming

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>
3 years agoBug 27932: Add GET /biblios/:biblio_id/pickup_locations route
Tomas Cohen Arazi [Thu, 11 Mar 2021 18:47:10 +0000 (15:47 -0300)]
Bug 27932: Add GET /biblios/:biblio_id/pickup_locations route

This patch adds the mentioned route. It does so by:
- Adding the new path in paths.json
- Adding the full route spec in biblios.json
- Adds a controller method that takes care of the task

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass!
3. Play with your favourite REST tool. Pay special care to
   the AllowHoldPolicyOverride syspref and the expected behaviors.
=> SUCCESS: All works as expected
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27932: Unit tests
Tomas Cohen Arazi [Thu, 11 Mar 2021 18:46:57 +0000 (15:46 -0300)]
Bug 27932: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28270: (bug 24279 follow-up) Fix tooltip for the claim lost status
Jonathan Druart [Fri, 30 Apr 2021 12:27:20 +0000 (14:27 +0200)]
Bug 28270: (bug 24279 follow-up) Fix tooltip for the claim lost status

It says "At least one item is available at this library" instead of
"Return claims must be processed from the patron details page"
(like on cataloguing/additem)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28170: Fix upload.tt search result buttons for page two onwards
Lari Taskula [Mon, 19 Apr 2021 14:54:34 +0000 (14:54 +0000)]
Bug 28170: Fix upload.tt search result buttons for page two onwards

From https://datatables.net/faqs/index

"When attaching events to cells in a table controlled by DataTables, you need
to be careful how it is done. Because DataTables removes nodes from the DOM,
events applied with a static event listener might not be able to bind
themselves to all nodes in the table."

Before this patch, there were three non-functional buttons on upload search
result page, "+ Choose", "Download" and "Delete".

This patch binds the handlers to a static element so that the three buttons
in upload.tt on page two onwards are functional again.

To test:
1. This test is for the "Download" and "Delete" buttons
1.1. Before applying patch, go to cgi-bin/koha/tools/upload.pl
1.2. Make sure you have at least 21 files uploaded
1.3. Perform a search via "Search term" form so that at least 21 results are
     returned (e.g. a dot (.) as the search term should return all files with
     filetype)
1.4. Press "Download" and "Delete" for the first result row, it should work
     as expected (no need to actually delete the file - as long as it pops up
     a confirmation, it works as expected)
1.5. Go to page 2 of results
1.6. Press "Download" and "Delete" for the first result in page 2
1.7. Observe nothing happening
1.8. Apply patch
1.9. Repeat steps 3-6
1.10. Observe buttons working as expected

2. This test is for the "+ Choose" button
2.1. Go to cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=856&frameworkcode=#subufield
2.2. Under "Other options (choose one), for "Plugin", select "upload.pl"
2.3. Find a biblio and click Edit Record
2.4. Go to 856$u and click "Upload"
2.5. Repeat steps 1.1. - 1.10., but this time for the "+ Choose" button

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY
Jonathan Druart [Mon, 26 Apr 2021 08:49:12 +0000 (10:49 +0200)]
Bug 28207: Fix biblio_framework.frameworktext isn't in GROUP BY

When a new framework is created and "Marc structure" is opened, a SQL
error happened if sql_strict_mode is on.

Test plan:
Create a 2 new biblio frameworks
Click "Marc structure" for one of them
=> You see the list of all frameworks with an existing structure

Signed-off-by: David Nind <david@davidnind.com>
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>
3 years agoBug 28217: Prevent several non-repeatable attributes to be merged
Jonathan Druart [Fri, 23 Apr 2021 13:37:46 +0000 (15:37 +0200)]
Bug 28217: Prevent several non-repeatable attributes to be merged

When using the patron merge feature it's possible to generate a patron
with several non-repeatable attributes.

This patch prevents that.

Test plan:
Create 2 patron attribute types, one repeatable and one non-repeatable
Create 2 patrons and add them repeatable attributes
Add a non-repeatable attribute to one of them
Merge the 2 patrons
=> It succeeds, the resulting patron has all the repeatable attribute
and the non-repeatable one.

Do it again but this time add non-repeatable to both patrons
Merge them
=> It fails, you should see an error on the UI
  Merge failed! The following error was reported: Tried to add more than one non-repeatable attributes. type=TYPE value=VALUE.

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>
3 years agoBug 27061: Remove duplicate permission check in svc/mana/search
Jonathan Druart [Fri, 20 Nov 2020 08:04:30 +0000 (09:04 +0100)]
Bug 27061: Remove duplicate permission check in svc/mana/search

There is a call to check_cookie_auth then another one to get_template_and_user

Test plan:
Use mana to create new report and new subscription.
Confirm that you need the necessary permissions to use it

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28244: DBRev 20.12.00.044
Jonathan Druart [Fri, 30 Apr 2021 07:49:22 +0000 (07:49 +0000)]
Bug 28244: DBRev 20.12.00.044

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28244: Fix typo in Ukrainian in history
Victor Grousset/tuxayo [Fri, 30 Apr 2021 01:38:28 +0000 (03:38 +0200)]
Bug 28244: Fix typo in Ukrainian in history

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28244: Fix typo in Ukrainian in language tables in English
David Cook [Wed, 28 Apr 2021 04:53:07 +0000 (04:53 +0000)]
Bug 28244: Fix typo in Ukrainian in language tables in English

This changes the English of Ukranian to Ukrainian.

1) Apply patch
2) Go to http://localhost:8080/cgi-bin/koha/opac-search.pl
3) Click on "Language" drop-down
4) Note near the bottom it says "Ukrainian" instead of "Ukranian"

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28258: DBRev 20.12.00.043
Jonathan Druart [Fri, 30 Apr 2021 07:50:26 +0000 (07:50 +0000)]
Bug 28258: DBRev 20.12.00.043

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28258: Fix existing occurrence
Jonathan Druart [Thu, 29 Apr 2021 08:43:31 +0000 (10:43 +0200)]
Bug 28258: Fix existing occurrence

I think it's good to fix the original problem as well

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>
3 years agoBug 28258: Update bad formatting in AUTO_RENEWALS notice
Lucas Gass [Wed, 28 Apr 2021 20:48:37 +0000 (20:48 +0000)]
Bug 28258: Update bad formatting in AUTO_RENEWALS notice

To test:
-Look at the AUTO_RENEWALS notice and see the syntax [% checkout.date_due as_due_date => 1 %]
-Apply patch, updatedatabase
-Look at the AUTO_RENEWALS notice and see the syntax [% checkout.date_due | $KohaDates as_due_date => 1%]

Additional test:
1 - Checkout an item to a patron
2 - Find their borrowernumber, the itemnumber, and the biblionumber
3 - Use the get_prepared_letter script to test the letter content
    perl misc/devel/get_prepared_letter.pl --module circulation --letter-code AUTO_RENEWALS --tables="{\"borrowers\": 5,\"issues\": 1040,\"items\": 1040,\"biblio\": 2 }"

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>
3 years agoBug 28250: Remove upload of debug for Selenium failures
Jonathan Druart [Wed, 28 Apr 2021 10:18:36 +0000 (12:18 +0200)]
Bug 28250: Remove upload of debug for Selenium failures

We added an upload of the source page and of the screenshot but both services are discontinued.

If we need them back we must host them ourselves.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28249: Prevent Selenium->wait_for_element_visible to fall in an infinite loop
Jonathan Druart [Wed, 28 Apr 2021 12:52:20 +0000 (14:52 +0200)]
Bug 28249: Prevent Selenium->wait_for_element_visible to fall in an infinite loop

Stop if max_retries is reached

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27811: Hide the Accounting tab if needed
Jonathan Druart [Thu, 22 Apr 2021 12:23:05 +0000 (14:23 +0200)]
Bug 27811: Hide the Accounting tab if needed

Same as the previous patch for the "Accounting" tab of the circulation
module.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27811: Hide payment buttons if not enough permission
Jonathan Druart [Thu, 22 Apr 2021 12:20:27 +0000 (14:20 +0200)]
Bug 27811: Hide payment buttons if not enough permission

If the logged in librarian does not have the updatecharges >
remaining_permissions subpermission, we should hide the 2 "Make payment"
and "Pay all fines" button from the patron detail/circ page.

Test plan:
1 - Grant an account circulation/staffaccess permissions and any subpermissions in updatechagres but NOT 'remaining_permissions'
2 - Add some charges to a patron account
3 - Sign in with the account created in #1
4 - Bring up the patron you added charges to
=> The two buttons are not displayed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27636: (QA follow-up) Unit tests for AutoReconcile
Martin Renvoize [Thu, 29 Apr 2021 06:39:21 +0000 (07:39 +0100)]
Bug 27636: (QA follow-up) Unit tests for AutoReconcile

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27636: (QA follow-up) Restore force AutoReconcile
Martin Renvoize [Wed, 28 Apr 2021 13:36:27 +0000 (14:36 +0100)]
Bug 27636: (QA follow-up) Restore force AutoReconcile

This patch restores the behaviour ->pay always acting as though
`AccountAutoReconcile` was enabled.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27636: Be explicit on the exception we expect
Jonathan Druart [Wed, 28 Apr 2021 09:32:09 +0000 (11:32 +0200)]
Bug 27636: Be explicit on the exception we expect

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27636: (QA follow-up) Fix tests and validate
Martin Renvoize [Wed, 28 Apr 2021 09:21:14 +0000 (10:21 +0100)]
Bug 27636: (QA follow-up) Fix tests and validate

This patch fixes the tests for when a negative amount is passed to the
pay method.  Prior to now, a negative amount would have been passed
through and recorded. This was inconsistent with all other accounts
methods and has been deprecated to ensure consistent amounts handling.

This patch also introduces basic validation to prevent negatives being
entered into the UI.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 17202: DBIC schema changes
Jonathan Druart [Thu, 29 Apr 2021 07:55:38 +0000 (09:55 +0200)]
Bug 17202: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 28202: Pickup libraries must be sorted by name when placing hold
Fridolin Somers [Fri, 23 Apr 2021 09:10:15 +0000 (11:10 +0200)]
Bug 28202: Pickup libraries must be sorted by name when placing hold

When placing hold, the pickup libraries are not sorted by name but by code.

You can see in other places : pickup_locations() calls
Koha::Libraries->search with { order_by => ['branchname'] }

Test plan :
1) Go to staff interface
2) Create a new libary with code 'AAA' and name 'ZZZ'.
2) Select a record
3) Begin placing hold
4) Look at list in "Pickup at:"
=> Without patch library 'ZZZ' is first
=> With patch library 'ZZZ' is last

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 28202: Unit test
Fridolin Somers [Fri, 23 Apr 2021 10:49:33 +0000 (12:49 +0200)]
Bug 28202: Unit test

Run prove t/db_dependent/Koha/Biblio.t

Note that sort must be case insensitive.

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>