koha.git
2 years agoBug 29242: Flatpickr - Should autocomplete be turned off?
Owen Leonard [Thu, 14 Oct 2021 17:56:23 +0000 (17:56 +0000)]
Bug 29242: Flatpickr - Should autocomplete be turned off?

This patch adds a step to Flatpickr initialization to add an
autocomplete attribute set to "off" so that browsers' built-in
autocomplete menus do not obscure the calendar.

To test you must be using a browser which has form history enabled.

Locate a form that includes a Flatpickr input field, e.g.  Reports
-> Catalog statistics.

Fill the date fields and submit the form. Go back to the form and click
one of the form fields you previously filled out (once in Chrome, twice
in Firefox). The browser should not show its native form history
dropdown.

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>
2 years agoBug 28901: Compiled CSS
Jonathan Druart [Tue, 2 Nov 2021 14:57:01 +0000 (15:57 +0100)]
Bug 28901: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28901: showCart incorrectly calculates position if content above navbar
Owen Leonard [Mon, 20 Sep 2021 14:57:23 +0000 (14:57 +0000)]
Bug 28901: showCart incorrectly calculates position if content above navbar

This patch makes changes to the OPAC Cart's CSS and JS so that the cart
pop-up message display more consistently. The CSS is changed to use
position "fixed" instead of "absolute." This allows the message to
display without recalculating the position every time, and keeps the
appearance we expect.

The z-index of the message is also increase to prevent it from being
hidden behind a floating toolbar.

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

 - Perform a catalog search in the OPAC which will return multiple
   results.
 - In the list of search results, click the "Add to cart" link next to
   several search results. Each time you should see a message appear in
   the upper left corner of the screen, "The item has been added to the
   cart."
 - The position of the messages should be consistent no matter how far
   down the page you scroll.
 - Test again after adding content to the OpacHeader region. One way to
   do this is to add the following to the OpacUserJS preference:

   $(document).ready(function(){
     $("#wrapper").prepend('<img src="https://generative-placeholders.glitch.me/image?width=900&height=200&style=triangles&gap=30">');
   });

 - Test at various browser widths, from a phone-sized screen width up to
   wide desktop-sized.

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>
2 years agoBug 28910: Correct eslint errors in OPAC basket.js
Owen Leonard [Fri, 17 Sep 2021 13:25:10 +0000 (13:25 +0000)]
Bug 28910: Correct eslint errors in OPAC basket.js

This patch corrects eslint errors in the OPAC copy of basket.js:
Indentation inconsistencies, undeclared variables, unused functions,
etc.

To test, apply the patch and test the "Cart" functionality in the
OPAC:

- In the OPAC, add an item to the cart.
- A popup message should appear telling you the item has been added.
- The "Add to cart" link should update to read "In your cart."
- The count if cart items in the header should be updated.
- The "In your cart (remove)" link should work correctly.
- Test this process from both the search results and
  detail pages.
- Open the cart.
- The cart should open correctly.
- In the cart, test all the controls:
  - More details
  - Send
  - Download
  - Empty and close
  - Hide window
  - Print
  - Select all / clear all
  - With checked items:
    - Remove
    - Add to list
    - Place hold
    - Tag

The following unused functions were removed: readCookieValue,
AllAreChecked, SelectAll, and quit. A search of the Koha codebase should
return no results from the opac-tmpl directory.

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>
2 years agoBug 28926: Update cpanfile for Mojolicious::Plugin::OpenAPI v2.16
Mason James [Tue, 31 Aug 2021 04:05:05 +0000 (16:05 +1200)]
Bug 28926: Update cpanfile for Mojolicious::Plugin::OpenAPI v2.16

to test...
 - apply patch
 - build package
 - confirm in about.pl that minimum versions are updated

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29319: Use Business::ISBN to check ISBNs on addbooks.pl/cataloging search
Lucas Gass [Mon, 25 Oct 2021 22:52:22 +0000 (22:52 +0000)]
Bug 29319: Use Business::ISBN to check ISBNs on addbooks.pl/cataloging search

To test:
1. Go to cataloging search and enter something like "7th Heaven".
2. Get an error when searching, Koha thinks you entered an ISBN
3. Apply patch
4. Try the same search, it should be a proper title search now
5. Find some stuff in the catalog with ISBN numbers in them.
6. The search should properly return ISBN13/ISBN10 searches, without with out the '-'.

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>
2 years agoBug 29350: Don't need to escape the 'delete' TT methods
Jonathan Druart [Thu, 28 Oct 2021 13:27:00 +0000 (15:27 +0200)]
Bug 29350: Don't need to escape the 'delete' TT methods

Will be needed by bug 22605.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29075: 'OPAC info' removed in branches.pl
Jérémy Breuillard [Wed, 27 Oct 2021 13:24:43 +0000 (13:24 +0000)]
Bug 29075: 'OPAC info' removed in branches.pl

In Administration › Libraries, we see content of OPAC info as escaped HTML.
This content may be long and seeing HTML tags is strange.

We should not show it in this table.
Or maybe create a modal preview of it (not escaped HTML).

To test :
1) Home > Administration > Libraries
2) In 'Address' column notice the 'OPAC info' field (if this one is
filled) with visible HTML tags
3) Apply patch
4) Repeat 1) and 'OPAC info' field should be gone

Signed-off-by: Owen <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28913: Note cronjob on automatic return settings in itemtypes
Andrew Fuerste-Henry [Fri, 27 Aug 2021 16:27:53 +0000 (16:27 +0000)]
Bug 28913: Note cronjob on automatic return settings in itemtypes

To test:
1 - go to itemtype config in Admin
2 - confirm it doesn't mention the automatic_return cron
3 - apply patch and restart
4 - confirm note now says "This feature requires the misc/cronjobs/automatic_checkin.pl cronjob. Ask your system administrator to schedule it."

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29223: Use patron's branchcode for digest if not sending digest per branch
Nick Clemens [Wed, 13 Oct 2021 15:20:05 +0000 (15:20 +0000)]
Bug 29223: Use patron's branchcode for digest if not sending digest per branch

To test:
 1 - Set system preference  AutoRenewalNotices to 'according to patron messaging preferences'
 2 - Set circ rule for auto renewal - 100 renewals allowed - no renewal before 100
    This shoud make a checkout eligible for many auto renewals for testing
 3 - Checkout an item to a patron, ensure item is from a different branch than patron
 4 - Ensure the patron has an email, and set an email for patron's branch and items branch
 5 - Set the patron messaging preferences for auto-renewal to 'email' and 'wants digest'
 6 - perl misc/cronjobs/automatic_renewals.pl --send-notices --confirm
 7 - Job dies:
    Can't call method "from_email_address" on an undefined value at /usr/share/koha/bin/cronjobs/automatic_renewals.pl line 286.
 8 - Apply patch
 9 - Repeat
10 - NO errors
11 - Check patron notices tab, should be a notice enqueued, check DB to see from address is patron's branch
12 - perl misc/cronjobs/automatic_renewals.pl --send-notices --confirm --digest-per-branch
13 - No errors
14 - Check patron notices tab, should be a notice enqueued, check DB to see from address is item's branch

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29152: Change default value for SearchLimitLibrary to 'homebranch'
Nick Clemens [Wed, 6 Oct 2021 12:56:39 +0000 (12:56 +0000)]
Bug 29152: Change default value for SearchLimitLibrary to 'homebranch'

Behvaiour before this option was added was 'homebranch'
We should preserve this rather than introduce a change

No atomic update added as liobraries may have already set/changed the value,
but safer to default to previous behvaiour

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: (follow-up) Add tests for invalid RFC3339 dates
Jonathan Druart [Mon, 8 Feb 2021 14:46:35 +0000 (15:46 +0100)]
Bug 24850: (follow-up) Add tests for invalid RFC3339 dates

Make this failure explicit, otherwise we get a "bad plan" failure.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: (QA follow-up) Add more comments
Martin Renvoize [Wed, 27 Jan 2021 09:18:45 +0000 (09:18 +0000)]
Bug 24850: (QA follow-up) Add more comments

To try and clarify the logic here I've added an addition comment to the
code.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: Continue to handle default time and daylight saving
Martin Renvoize [Thu, 26 Mar 2020 11:12:26 +0000 (11:12 +0000)]
Bug 24850: Continue to handle default time and daylight saving

This patch prevents the call to set_time_zone if we are handling a
dateonly datetime string or a DST time

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: Always return 'instance' local time
Martin Renvoize [Tue, 17 Mar 2020 10:22:16 +0000 (10:22 +0000)]
Bug 24850: Always return 'instance' local time

This patch adds handling to ensure we always convert a passed in time to
the instance configured timezone..

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: Don't fallback when date_format is passed
Martin Renvoize [Wed, 11 Mar 2020 17:55:34 +0000 (17:55 +0000)]
Bug 24850: Don't fallback when date_format is passed

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: Add tests for invalid RFC3339 dates
Martin Renvoize [Wed, 11 Mar 2020 16:20:36 +0000 (16:20 +0000)]
Bug 24850: Add tests for invalid RFC3339 dates

We should die on invalidly formatted dates being passed.  This patch
adds such a test case.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: Correct offset handling in dt_from_string
Martin Renvoize [Wed, 11 Mar 2020 15:59:19 +0000 (15:59 +0000)]
Bug 24850: Correct offset handling in dt_from_string

This patch adds correct handling for when an offset is passed within an
RFC3339 formatted datetime.

Test plan
1/ Run the DateUtils test and varify it now passes.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24850: Correct tests for offset handling in RFC3339 dates
Martin Renvoize [Wed, 11 Mar 2020 15:57:07 +0000 (15:57 +0000)]
Bug 24850: Correct tests for offset handling in RFC3339 dates

The tests were incorrectly passing for RFC3339 dates passed with an
offset.  This patch corrects the test.

Test plan:
1/ Read the change
2/ Agree the change adheres to the RFC
3/ Run the test and varify it now fails
3/ Signoff

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29283: (QA follow-up) Remove code duplication
Joonas Kylmälä [Sun, 31 Oct 2021 12:22:06 +0000 (12:22 +0000)]
Bug 29283: (QA follow-up) Remove code duplication

We have already a search filter for active orders.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29283: Don't attempt to cancel cancelled orders
Nick Clemens [Wed, 20 Oct 2021 13:06:06 +0000 (13:06 +0000)]
Bug 29283: Don't attempt to cancel cancelled orders

When deleting a basket we cancel all the contained orders - when a
basket contains an order that was previously cancelled this can cause
an error if the biblio was deleted

When picking the orders to cancel, we should limit our search
to those not already cancelled.

To test:
- have a basket with at least one order
- click "Cancel order and delete catalog record", confirm cancellation of order and deletion of bib
- click "Delete basket", confirm deletion
- get error "Cannot insert order: Mandatory parameter biblionumber is missing at /kohadevbox/koha/acqui/basket.pl line 136.
 at /usr/share/perl/5.28/Carp.pm line 289"
- apply patch
- restart
- delete the basket
- success!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26871: Flush SIP2 cache on every SIP request
Joonas Kylmälä [Sun, 10 Oct 2021 11:01:29 +0000 (11:01 +0000)]
Bug 26871: Flush SIP2 cache on every SIP request

SIP connections tend to be long lived, weeks if not months, in the
libraries I see. Basically the connection per SIP machine is initiated
once when the SIP machine boots and then never closed until
maintanance needs to be done. Therefore we need to reset the Koha's L1
caches on every SIP request to get the latest sysprefs and configs
from the memcached cache that is shared between all the Koha
programs (intranet, opac, sip, cronjobs) and is guaranteed to be up to
date.

To test:
 0. Have kohadevbox
 1. Enable IssueLog
 2. In one terminal run the command "perl C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml"
 3. Checkin and return a book using telnet:

    $ telnet localhost 6001
    9300CNterm1|COterm1|CPCPL|
    11YN20211010    10565320211010    105653AOCPL|AA1|AB3999900000001|ACterm1|BON|BIN|
    09N20211010    10564420211010    105644APCPL|AOCPL|AB3999900000001|ACterm1|BIN|

 4. Keep the telnet connection open and go to
    http://localhost:8081/cgi-bin/koha/tools/viewlog.pl and check that
    the *checkout* entry is in the circulation rules 5.
 6. Disable IssueLog
 7. Move back to the telnet prompt and check out and return a book again

    11YN20211010    10565320211010    105653AOCPL|AA1|AB3999900000001|ACterm1|BON|BIN|
    09N20211010    10564420211010    105644APCPL|AOCPL|AB3999900000001|ACterm1|BIN|

 8. Go check out the circulation logs and notice a new entry was added
    when it shouldn't have according to the IssueLog syspref!
 9. Apply patch and repeat steps to notice that the syspref is now
    followed correctly.

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>
2 years agoBug 14999: Make sure order prices are not mixed-up
Joonas Kylmälä [Sat, 2 Oct 2021 12:28:52 +0000 (12:28 +0000)]
Bug 14999: Make sure order prices are not mixed-up

We were shifting the price and replacement price for imported orders
only after the line:

> $duplinbatch = $import_batch_id and next if $duplifound;

This lead to the "replacementprice" and "price" query parameters not
being shifted/removed from the list if a duplicate record came across
and caused the prices be applied to the next record being imported.

To reproduce:
 1) Download two records from koha to marcxml file, then cat those:
   cat bib1.marcxml bib2.marcxml > bibs.marcxml
 2) Delete bib2 from koha
 3) Stage bibs.marcxml for import
 4) Create a new order basket, then "Add to basket" using "From a
    staged file" option
 5) Select both bib1 and bib2 and set price & replacement price for
    bib1 to be 99.00 and for bib2 to be 88.00
 6) Click save and notice bib2 was imported with the wrong prices, 99.00!
 7) Apply patch and notice the prices are now correctly set to 88.00.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24370: Allow resetting library to ANY
Jonathan Druart [Wed, 25 Aug 2021 11:55:36 +0000 (13:55 +0200)]
Bug 24370: Allow resetting library to ANY

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24370: (QA follow-up) Make new suggestions default to the library you re viewing
Nick Clemens [Tue, 20 Oct 2020 18:19:46 +0000 (18:19 +0000)]
Bug 24370: (QA follow-up) Make new suggestions default to the library you re viewing

It looks like this problem was caused by code from bug 25033, we were attempting to have the
dropdown either be the current branch filter, or the suggestion's branch code, but the variables here are confusing and it didn't work

This explicitly sets the branchcode when creating a new suggestion to allow fixing current behaviour and
show the correct value when creating new

To test:
1 - Be signed in as branch A
2 - Browse to suggestions and limit to branch "Any"
3 - Click 'New suggestion"
4 - Defaults to Any
5 - Cancel and limit to branch B
6 - New suggestion defaults to branch B

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 24370: Don't reset library when editing a suggestion
Katrin Fischer [Mon, 5 Oct 2020 17:23:31 +0000 (17:23 +0000)]
Bug 24370: Don't reset library when editing a suggestion

When editing a suggestion, the library will be reset to the currently
logged in librarian's homebranch, no matter what the libray was before.

This fixes this, the library selection will remain at the db value when
edited.

To test:
- Create a suggestion with Any library.
- Edit the suggestion - it will show your homebranch as library
- Change to any library but your homebranch
- The summary should show the correct value after saving
- Edit the suggestoin again - it's set back to your homebranch again
- Apply patch
- Repeat the steps, the pull down should now show the correct library
  at all times.

Caveat: I think there is a somewhat separate issue/bug in that once a library
was saved, you cannot switch back to "Any". I haven't been able to fix this and
suggest to maybe file a separate bug.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28573: Replace authority record with Z39.50/SRU creates new authority record
George Veranis [Tue, 12 Oct 2021 21:01:57 +0000 (23:01 +0200)]
Bug 28573: Replace authority record with Z39.50/SRU creates new authority record

When trying to replace an authority record with Z39.50/SRU then a new authority
record is created without deleting the old one and not link the new one with
any record.

This patch fixes that.

Test plan:

1) Try to catalogue a new authority record from cataloguing form.
2) Try to replace that authority record with Z39.50/SRU, then a new authority
record is created and also you have that one that you tried to replace.
3) Apply the patch.
4) Try to replace the authority from step1 with Z39.50/SRU, then is working as
expected.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 17600: Fix imports for GetClassSources in guided_reports.pl
Owen [Thu, 28 Oct 2021 13:14:06 +0000 (13:14 +0000)]
Bug 17600: Fix imports for GetClassSources in guided_reports.pl

This will fix the broken option to use cn_source as a runtime
parameter, e.g. <<Call no. source|cn_source>>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: (QA follow-up) One more lost 'category' to 'public' change
Andrew Nugged [Mon, 1 Nov 2021 07:07:03 +0000 (09:07 +0200)]
Bug 28959: (QA follow-up) One more lost 'category' to 'public' change

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: Fix occurrence in tools/batch_record_modification.pl
Jonathan Druart [Tue, 2 Nov 2021 10:39:30 +0000 (11:39 +0100)]
Bug 28959: Fix occurrence in tools/batch_record_modification.pl

No method count found for Koha::Virtualshelves DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Unknown column 'category' in 'where clause' at /kohadevbox/koha/Koha/Objects.pm line 601                                                                                                                                                                             at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt line 80.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29374: Don't crash if search engine returns a deleted record
Jonathan Druart [Fri, 29 Oct 2021 10:27:25 +0000 (12:27 +0200)]
Bug 29374: Don't crash if search engine returns a deleted record

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29368: Fix remove_from_cart
Jonathan Druart [Fri, 29 Oct 2021 10:27:32 +0000 (12:27 +0200)]
Bug 29368: Fix remove_from_cart

Reusing what has been done previously.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29368: Correctly mock Zebra index from tests
Jonathan Druart [Fri, 29 Oct 2021 09:15:48 +0000 (11:15 +0200)]
Bug 29368: Correctly mock Zebra index from tests

This is just reusing what is done in Search.t (and that is correct).
But search_utf8.t and remove_from_cart.t are wrong as we want to use the
UI (and we cannot mock the zebra index, ie. koha-conf, from tests for
plack).

This still needs some work but improve a bit the existing code and make
tests pass (hopefully!)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29364: Revert changes to framework visibility made by Search.t
Jonathan Druart [Fri, 29 Oct 2021 08:33:57 +0000 (10:33 +0200)]
Bug 29364: Revert changes to framework visibility made by Search.t

To recreate run:

drop database koha_kohadev;
create database koha_kohadev;

restart_all

KOHA_TESTING=1 prove t/db_dependent/selenium/01-installation.t t/db_dependent/Search.t t/db_dependent/Koha/UI/Form/Builder/Item.t
        #   Failed test 'Item types should be sorted by description and an empty entries should be shown'
        #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 127.
        #     Structures begin differing at:
        #          $got = undef
        #     $expected = ARRAY(0x557716b68e98)
        # Itemtypes details: $VAR1 = undef;
        # $VAR2 = [
        #           'BK',
        #           'CF',
        #           'CR',
        #           'ihxGmo7',
        #           'MP',
        #           'MU',
        #           'MX',
        #           'REF',
        #           'VM'
        #         ];

        #   Failed test 'Labels should be correctly displayed'
        #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 130.
        #     Structures begin differing at:
        #          $got = undef
        #     $expected = HASH(0x557716e2e150)
        # Looks like you failed 2 tests of 2.

    #   Failed test 'itemtypes'
    #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 133.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29363: Fix TestBuilder.t if bib 123 does not exist
Jonathan Druart [Fri, 29 Oct 2021 07:59:29 +0000 (09:59 +0200)]
Bug 29363: Fix TestBuilder.t if bib 123 does not exist

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: DBIC update
Tomas Cohen Arazi [Tue, 7 Sep 2021 11:09:39 +0000 (08:09 -0300)]
Bug 28959: DBIC update

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: DBRev 21.06.00.039
Jonathan Druart [Thu, 28 Oct 2021 15:47:05 +0000 (17:47 +0200)]
Bug 28959: DBRev 21.06.00.039

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: Fix other cases
Tomas Cohen Arazi [Thu, 28 Oct 2021 14:58:36 +0000 (11:58 -0300)]
Bug 28959: Fix other cases

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: (follow-up) Adjust more places in which 'category' was used
Fridolin Somers [Sat, 11 Sep 2021 06:50:31 +0000 (20:50 -1000)]
Bug 28959: (follow-up) Adjust more places in which 'category' was used

Some links still had category.

I propose we use explicit public=1 and public=0 when links to public/private are side by side.
Otherwise whe just use /cgi-bin/koha/opac-shelves.pl?op=list using default value 0.

Signed-off-by: David Nind <david@davidnind.com>
JK: Adjust commit title
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: (follow-up) Adjust all places in which 'category' was used
Tomas Cohen Arazi [Wed, 8 Sep 2021 19:44:16 +0000 (16:44 -0300)]
Bug 28959: (follow-up) Adjust all places in which 'category' was used

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: Add virtualshelves.public as a boolean
Tomas Cohen Arazi [Tue, 7 Sep 2021 15:19:03 +0000 (12:19 -0300)]
Bug 28959: Add virtualshelves.public as a boolean

This patchset moves the 'category' attribute for virtual shelves, that
takes values of 1 and 2 (private and public respectively) into a boolean
for public.

The DBRev is trivial, and the changes to the code are as well.

To test:
1. have some known public and private lists
2. Apply this patches
3. Run:
   $ updatedatabase
=> SUCCESS: Public lists have public=1, private have public=0
4. Run:
   $ kshell
  k$ prove t/db_dependent/Utils/Datatables_Virtualshelves.t \
           t/db_dependent/Virtualshelves.t
=> SUCCESS: Tests pass!
5. Try the feature in staff and OPAC
=> SUCCESS: All good
6. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28959: Move category => public
Tomas Cohen Arazi [Tue, 7 Sep 2021 11:06:59 +0000 (08:06 -0300)]
Bug 28959: Move category => public

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29290: Unit tests
Tomas Cohen Arazi [Wed, 27 Oct 2021 12:06:44 +0000 (09:06 -0300)]
Bug 29290: Unit tests

This patch adds unit tests for the new route. All behaviors are tested:

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29290: Add GET /biblios/:biblio_id/checkouts
Tomas Cohen Arazi [Wed, 20 Oct 2021 21:12:41 +0000 (18:12 -0300)]
Bug 29290: Add GET /biblios/:biblio_id/checkouts

This patch adds the required controller method.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 29290: Rename relationships borrower => patron
Tomas Cohen Arazi [Wed, 20 Oct 2021 19:59:38 +0000 (16:59 -0300)]
Bug 29290: Rename relationships borrower => patron

This is a trivial change that is required to be able to embed patron
objects in the (old) checkout object.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 29290: Add spec changes
Tomas Cohen Arazi [Wed, 20 Oct 2021 21:09:35 +0000 (18:09 -0300)]
Bug 29290: Add spec changes

This patch adds the new route. It also tweaks the checkout object
definition to allow embedding the required related objects (for bug 29275).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 29288: Add current_checkouts and old_checkouts methods to Koha::Biblio
Tomas Cohen Arazi [Wed, 20 Oct 2021 21:02:01 +0000 (18:02 -0300)]
Bug 29288: Add current_checkouts and old_checkouts methods to Koha::Biblio

This patch adds helper methods for accessing current and past checkouts
for a given Koha::Biblio object.

To test:
1. Apply the unit tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> FAIL: Methods are not implemented
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: 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>
2 years agoBug 29288: Unit tests
Tomas Cohen Arazi [Wed, 20 Oct 2021 21:01:42 +0000 (18:01 -0300)]
Bug 29288: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 29108: Add q parameters to items routes
Tomas Cohen Arazi [Fri, 24 Sep 2021 12:05:21 +0000 (09:05 -0300)]
Bug 29108: Add q parameters to items routes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29107: Rename item_type => item_type_id
Tomas Cohen Arazi [Fri, 24 Sep 2021 11:28:17 +0000 (08:28 -0300)]
Bug 29107: Rename item_type => item_type_id

This simple change renames the attribute in the item object API
representation.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass
2. Run:
   $ git grep 'api/v1/items'
=> SUCCESS: The items routes are not (yet) used in Koha
3. Run:
   $ cd koha-tmpl
   $ git grep --name-only '"embed"'
=> SUCCESS: Only two templates are using embed.
4. Check:
   - register.tt uses it to embed the manager, good
   - parcel.tt uses it to embed items. Alert.
=> SUCCESS: parcel.tt only uses a count on items. No item_type involved.
5. Sign off

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27358: Add GET /public/biblios/:biblio_id/items
Tomas Cohen Arazi [Thu, 7 Jan 2021 11:50:43 +0000 (08:50 -0300)]
Bug 27358: Add GET /public/biblios/:biblio_id/items

This patch introduces a route to fetch items belonging to a biblio. It
is expected to return the 'public' representation of the Koha::Item
objects.

It is also enforcing the visibility rules, by using
Koha::Items->filter_by_visible_in_opac.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Test pass and they cover all the cases!
3. Try your favourite REST tool against the new route.
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27358: Unit tests for public items retrieval
Tomas Cohen Arazi [Thu, 7 Jan 2021 18:38:54 +0000 (15:38 -0300)]
Bug 27358: Unit tests for public items retrieval

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28948: Fix random failure
Tomas Cohen Arazi [Thu, 28 Oct 2021 12:30:41 +0000 (09:30 -0300)]
Bug 28948: Fix random failure

This patch makes the query for randomly generated libraries
deterministic, thus getting rid of the random tests failures.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28948: Don't require catalogue permission for public route, don't allow smtp...
Kyle M Hall [Thu, 7 Oct 2021 18:46:53 +0000 (18:46 +0000)]
Bug 28948: Don't require catalogue permission for public route, don't allow smtp server embed

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>
2 years agoBug 28948: Remove query params, 'q' param covers everything needed
Kyle Hall [Thu, 7 Oct 2021 18:42:33 +0000 (14:42 -0400)]
Bug 28948: Remove query params, 'q' param covers everything needed

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>
2 years agoBug 28948: Remove FIXME
Tomas Cohen Arazi [Thu, 7 Oct 2021 17:51:51 +0000 (14:51 -0300)]
Bug 28948: Remove FIXME

This patch reproduces what we did for `to_api_mapping`: make it always
present on Koha::Object classes. This has the side-effect of... making
things more secure!

Before this patch, if undefined, all attributes were returned.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 28948: (QA follow-up) Convert to allow-list
Martin Renvoize [Fri, 3 Sep 2021 11:18:03 +0000 (12:18 +0100)]
Bug 28948: (QA follow-up) Convert to allow-list

This patch converts the code to use an allow-list as aposed to a
deny-list.  This is more 'fail safe' than requireing maintanence of a
deny-list.

We also switch to using db fields names for the list as aposed to api
mapped names. This way, the list can be re-used for non-api related
sanitising if required.

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>
2 years agoBug 28948: Add GET /public/libraries routes
Tomas Cohen Arazi [Thu, 7 Jan 2021 11:50:43 +0000 (08:50 -0300)]
Bug 28948: Add GET /public/libraries routes

This patch introduces a route to fetch a list of libraries or a single
library as expected on the /public namespace. It is expected to return
the 'public' representation of the Koha::Library objects.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/libraries.t
=> SUCCESS: Test pass and they cover all the cases!
3. Try your favourite REST tool against the new route.
4. Sign off :-D

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>
2 years agoBug 28948: Teach objects.search about public requests
Tomas Cohen Arazi [Thu, 7 Jan 2021 16:18:27 +0000 (13:18 -0300)]
Bug 28948: Teach objects.search about public requests

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>
2 years agoBug 28948: Make is_public stashed on public routes
Tomas Cohen Arazi [Thu, 7 Jan 2021 15:36:42 +0000 (12:36 -0300)]
Bug 28948: Make is_public stashed on public routes

This patch makes the API authentication code stash the 'is_public' value
when public routes are hit.

This will be particularly useful to have $c->objects->search generically
pass this info down to the ->to_api method.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/auth_authenticate_api_request.t
=> SUCCESS: Tests pass! When a public route is reached, the controller
has the 'is_public' value stashed
3. Sign off :-D

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>
2 years agoBug 28948: Add a generic way to handle API privileged access attributes deny-list
Tomas Cohen Arazi [Wed, 6 Jan 2021 19:16:01 +0000 (16:16 -0300)]
Bug 28948: Add a generic way to handle API privileged access attributes deny-list

This patch introduces a way for Koha::Object(s)->to_api to filter out
attributes that require privileged access. It is done in a way that the
'public' parameter is recursively passed to nested objects in recursive
to_api() calls.

This way, Koha::Object-based classes can determine how they will render
depending on this parameter. For example, for implementing a
route for fetching an library looks like:

GET /libraries

The controller will look like:

my $library = Koha::Libraries->find( $c->validation->param('library_id') );
return $c->render(
    status  => 200,
    openapi => $library->to_api
);

Implementing an unprivileged (public) route would look like:

GET /public/libraries/:library_id

The controller will look like:

my $library = Koha::Libraries->find( $c->validation->param('library_id') );
return $c->render(
    status  => 200,
    openapi => $library->to_api({ public => 1  })
);

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object*.t
=> SUCCESS: Tests pass (i.e. current behaviour is kept, new behaviour
        passes the tests)
3. Sign off :-D

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>
2 years agoBug 17314: Implement /suggestions routes
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:48:11 +0000 (14:48 -0300)]
Bug 17314: Implement /suggestions routes

This patch introduces routes to handle purchase suggestions, from the
staff POV.

Tests are added as well.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/suggestions.t
=> SUCCESS: Tests pass! And they are meaningful!
3. Play with your favourite REST tool (Postman?)
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>
2 years agoBug 17314: OpenAPI spec
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:43:31 +0000 (14:43 -0300)]
Bug 17314: OpenAPI spec

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 17314: Unit tests
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:48:54 +0000 (14:48 -0300)]
Bug 17314: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 17314: Make TestBuilder set good defaults for Suggestions
Tomas Cohen Arazi [Fri, 23 Apr 2021 17:41:08 +0000 (14:41 -0300)]
Bug 17314: Make TestBuilder set good defaults for Suggestions

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28859: Correctly handle 'Checked out by' visibility
Jonathan Druart [Wed, 13 Oct 2021 08:25:37 +0000 (10:25 +0200)]
Bug 28859: Correctly handle 'Checked out by' visibility

We must have the column in the table and let DT deal with the
visibility.

This patch hides the "Checked out by" column by default if
RecordStaffUserOnCheckout is off, but the DT column settings is aware of
its existence and the end user can still display the column.

IMO that's the most optimal situation considering both maintenance and ergonomic.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28859: Fix missing column setting
Andrew Isherwood [Fri, 17 Sep 2021 13:14:36 +0000 (14:14 +0100)]
Bug 28859: Fix missing column setting

This commit adds the missing checked_out_by column to
columns_settings.yaml

Test plan:

- Follow the test plans in the bug description and note that the
symptoms are no longer seen

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>
2 years agoBug 29229: (follow-up) Update method for linking flatpickr fields
Owen Leonard [Tue, 26 Oct 2021 18:19:27 +0000 (18:19 +0000)]
Bug 29229: (follow-up) Update method for linking flatpickr fields

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29229: Use Flatpickr in suggestion search sidebar filter
Owen Leonard [Wed, 13 Oct 2021 19:05:10 +0000 (19:05 +0000)]
Bug 29229: Use Flatpickr in suggestion search sidebar filter

This patch corrects the date field configurations for the suggestions
sidebar filter. These fields are now linked Flatpickr widgets instead of
jQueryUI datepickers.

To test, apply the patch and go to Suggestions.

- In the sidebar, click "Suggestion information" to expand the form.
- Test these linked date fields:
  - "Suggested date from" and "to"
  - "Managed date from" and "to"
  - "Accepted by from" and "to"
- Each should trigger Flatpickr calendars which are linked, i.e. you
  can't select a "to" date which is before a "from" date.
- Test that the dates submit correctly to filter as expected.

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>
2 years agoBug 29261: (bug 15812 follow-up 2) Fix translation issue in include file
Jonathan Druart [Thu, 28 Oct 2021 15:19:49 +0000 (17:19 +0200)]
Bug 29261: (bug 15812 follow-up 2) Fix translation issue in include file

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29301: Display error with serials search flatpickr when searching Mana
Owen Leonard [Thu, 21 Oct 2021 12:16:07 +0000 (12:16 +0000)]
Bug 29301: Display error with serials search flatpickr when searching Mana

This patch changes the way certain serials search fields are hidden when
a standalone search of Mana is being performed (from the "Search on
Mana" link). Instead of targeting specific labels and inputs to hide we
can hide list items by class.

Unrelated: This patch updates the page heading so that it is different
depending on whether you're searching Koha subscriptions or Mana
subscriptions.

To test, apply the patch and enable Mana.

- Go to Serials -> Advanced search (in the search header).
- The search form should include all fields, including call number,
  vendor, library, location, and "Expires before."
- Click "Search on Mana" in the sidebar.
- This page should have the heading "Mana subscriptions search," and
  there should only be three fields visible: ISSN, Title, and Publisher.
- When you perform a Mana search which returns results the page should
  have the heading "Mana subscriptions (X found).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29299: (follow-up) Add markup comments
Owen Leonard [Thu, 21 Oct 2021 12:02:06 +0000 (12:02 +0000)]
Bug 29299: (follow-up) Add markup comments

This patch adds comments to the template to highlight the markup
structure.

This patch should have no effect on the page's appearance or
functionality.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29299: Reindent serials search template
Owen Leonard [Thu, 21 Oct 2021 11:51:47 +0000 (11:51 +0000)]
Bug 29299: Reindent serials search template

This patch updates the serials search template to give it consistent
indentation.

The patch also moves one section of markup: The <tfoot> section is moved
to after <tbody> in order to conform to current standards.

To test, apply the patch and go to Serials -> Search subscriptions (in
the header).

- Serials search should work correctly and the page should look correct.
- With Mana enabled, click on the "Search on Mana" link in the sidebar.
- Searches of Mana should work correctly too.
- If you view the diff while ignoring whitespace the only changes should
  be the move of <tfoot> and places  where line breaks were introduced.

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>
2 years agoBug 28613: Add missing parameters to objects.search-based routes
Tomas Cohen Arazi [Tue, 22 Jun 2021 11:52:56 +0000 (08:52 -0300)]
Bug 28613: Add missing parameters to objects.search-based routes

The objects.search helper provides convenient ways to paginate and a 'q' filter parameter to build complex queries on this Koha::Objects-based routes.

Some routes were created prior to this feature getting introduced. We need to adjust the parameters for all existing objects.search-based routes.

This patch adds that.

The only GET (as in list) routes that would still be missing the
parameters are those about ILL, that are not objects.search based, and
probably need to be rewritten.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29300: Add 22.05 release team to teams.yaml
Martin Renvoize [Thu, 21 Oct 2021 12:10:35 +0000 (13:10 +0100)]
Bug 29300: Add 22.05 release team to teams.yaml

Add the 22.05 release team.

Test plan
1/ Check against
   https://wiki.koha-community.org/wiki/Release_Teams

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29218: Rename .hidden class for DT visibility
Jonathan Druart [Wed, 13 Oct 2021 08:16:00 +0000 (10:16 +0200)]
Bug 29218: Rename .hidden class for DT visibility

.hidden get the CSS that interferes with DT behaviour

.hidden {
    display: none !important;
}

Test this patch with bug 28859.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28349: (bug 26234 follow-up) Correct wrong array merge
Jonathan Druart [Thu, 7 Oct 2021 10:17:51 +0000 (12:17 +0200)]
Bug 28349: (bug 26234 follow-up) Correct wrong array merge

Bug 26234 allowed to remove the different classes we use in aoColumnDefs
for sorting columns of table using DT.

However there is a terrible mistake, the merge of existing aoColumnDefs
array with the default one is totally wrong:
  $.extend(true, new_parameters, default_column_defs);
When we actually wanted to do:
  $.extend(true, new_parameters["aoColumnDefs"], default_column_defs);

But it's still wrong, extend is doing a deep copy and the array will be
replaced by the other one, whereas we want to append.

We want to merge default_column_defs with the existing aocolumnDefs,
this patch is doing it explicitely.

This bug only exists when there is an existing aocolumnDefs.

See commit d3f3a55e0b1544ebcd3166d141e126a4324baab1
It happens on:
 * cataloguing/z3950_search.tt
 * reports/guided_reports_start.tt
 * serials/subscription-detail.tt
 * opac-course-reserves.tt
 * opac-detail.tt

However this bug has been hidden as we have in master related bug from
bug 27945, which removes title-string.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29272: (QA follow-up) Category setup overrides syspref
Tomas Cohen Arazi [Sun, 24 Oct 2021 22:54:24 +0000 (19:54 -0300)]
Bug 29272: (QA follow-up) Category setup overrides syspref

This patch removes an early short-circuit we had, which wasn't correct
regarding the OpacPasswordChange syspref. If a patron category is
allowed to change password, it overrides the syspref.

To test:
1. Tests still pass.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29272: Make public password changing honour category constraints
Tomas Cohen Arazi [Tue, 19 Oct 2021 13:29:55 +0000 (10:29 -0300)]
Bug 29272: Make public password changing honour category constraints

This patch makes the public API routes validate
$user->category->effective_change_password before allowing the change.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_password.t
=> FAIL: Tests fail, it allows the first change instead of returning
         403.
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: 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>
2 years agoBug 29272: Regression tests
Tomas Cohen Arazi [Tue, 19 Oct 2021 13:27:53 +0000 (10:27 -0300)]
Bug 29272: Regression tests

This patch introduces regression tests for the described bug.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons_password.t
=> FAIL: Tests fail, excepted failures are considered success

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
2 years agoBug 26374: update from bug 19974 is not idempotent
Nick Clemens [Thu, 3 Sep 2020 16:35:57 +0000 (16:35 +0000)]
Bug 26374: update from bug 19974 is not idempotent

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29332: Set default library limits in search_for_display
Martin Renvoize [Wed, 27 Oct 2021 10:50:18 +0000 (11:50 +0100)]
Bug 29332: Set default library limits in search_for_display

Koha::AdditionalContents->search_for_display needs to filter to just
items with a 'null' branchcode if no library_id is passed.

Test plan
1/ Add some additional content blocks that should display only for
specific branches.
2/ Navigate to the OPAC and note that blocks display for all libraries
prior to login
3/ Login to the OPAC and note that now you only see you users library
block
4/ Apply the patch
5/ Repeat steps 2 and 3 and note that now you see only the 'All
libraries' blocks display prior to login and that 'All libraries' +
'Your users library' blocks appear after login.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29332: Unit tests
Martin Renvoize [Wed, 27 Oct 2021 11:07:02 +0000 (12:07 +0100)]
Bug 29332: Unit tests

This patch adds unit tests to ensure we do not leak branch specific
addtional contents blocks outside of logged in sessions (i.e. where a
users branch is not yet set).

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28445: Add diag for failing test
Jonathan Druart [Thu, 28 Oct 2021 10:15:17 +0000 (12:15 +0200)]
Bug 28445: Add diag for failing test

Temporary patch to help trying to fix the following random error:
     #   Failed test 'Item types should be sorted by description and an empty entries should be shown'
     #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 121.
     #     Structures begin differing at:
     #          $got->[12] = 'Be9T9FH5aO'
     #     $expected->[12] = 'REF'
     # Looks like you failed 1 test of 2.

 #   Failed test 'itemtypes'
 #   at t/db_dependent/Koha/UI/Form/Builder/Item.t line 130.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28445: Fix LostItem call and display errors
Jonathan Druart [Thu, 28 Oct 2021 10:03:58 +0000 (12:03 +0200)]
Bug 28445: Fix LostItem call and display errors

Never a try without a catch, ever!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28445: Remove modified_itemitemnumbers
Jonathan Druart [Thu, 28 Oct 2021 09:47:07 +0000 (11:47 +0200)]
Bug 28445: Remove modified_itemitemnumbers

Wrong substitution

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28445: Correctly count modified items
Jonathan Druart [Thu, 28 Oct 2021 09:40:09 +0000 (11:40 +0200)]
Bug 28445: Correctly count modified items

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28445: Add tests for subfields_to_prefill
Jonathan Druart [Thu, 28 Oct 2021 08:47:51 +0000 (10:47 +0200)]
Bug 28445: Add tests for subfields_to_prefill

I first wrote test for another thing but the code was actually correct.
So submitting the tests.

Note that the marc for more_subfields does not need to be passed, we can
build it when needed.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix for prefill preventing duplication 2
Andrew Nugged [Wed, 27 Oct 2021 21:22:28 +0000 (00:22 +0300)]
Bug 27526: Fix for prefill preventing duplication 2

Prefill feature should not be in the priority
when user choose "Duplicate" for the item

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix SubfieldsToUseWhenPrefill
Jonathan Druart [Thu, 28 Oct 2021 08:43:05 +0000 (10:43 +0200)]
Bug 27526: Fix SubfieldsToUseWhenPrefill

my $a = "z";
my @x = split ( ' ', $a ) || ("");

@x will be [1]

Which is not at all what we are expecting here!
Be more verbose and don't introduce bug.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14957: DBIC changes - Remove MarcOverlayRulesModule.pm
Jonathan Druart [Wed, 27 Oct 2021 07:17:25 +0000 (09:17 +0200)]
Bug 14957: DBIC changes - Remove MarcOverlayRulesModule.pm

Where is that coming from??

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14957: Fix perlcritic error on admin/marc-overlay-rules.pl
Jonathan Druart [Wed, 27 Oct 2021 07:16:42 +0000 (09:16 +0200)]
Bug 14957: Fix perlcritic error on admin/marc-overlay-rules.pl

Subroutine "new" called using indirect syntax at line 30, column 13.  See page 349 of PBP.  (Severity: 4)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Correct NULL vs empty string when editing
Jonathan Druart [Mon, 11 Oct 2021 09:11:26 +0000 (11:11 +0200)]
Bug 27526: Correct NULL vs empty string when editing

When an item is edit we must keep the NULL values in DB if the input
have been left empty.
It also fixes the "barcode cannot be unique" error when an item does not
have a barcode.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29318: Tidy the code
Nick Clemens [Mon, 25 Oct 2021 18:50:17 +0000 (18:50 +0000)]
Bug 29318: Tidy the code

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>
2 years agoBug 29318: Remove permission check from overdrive search page
Nick Clemens [Mon, 25 Oct 2021 18:47:22 +0000 (18:47 +0000)]
Bug 29318: Remove permission check from overdrive search page

This removes the 'edit_borrowers' permission from OverDrive search

To test:
1 - Enable OverDrive via koha system preferences
2 - Sign in to opac with a user with no permissions
3 - Perform a search that will return OD results, 'love' works
4 - Click thje "Found XX results in the library's OverDrive collection"
5 - Note you are logged out of Koha
6 - Apply patch
7 - Repeat
8 - Success

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>
2 years agoBug 29286: Typo: Librarien will need the manage_auth_values subpermission.
Owen Leonard [Mon, 25 Oct 2021 18:00:12 +0000 (18:00 +0000)]
Bug 29286: Typo: Librarien will need the manage_auth_values subpermission.

This patch fixes a typo in the Cataloging system preferences text.

"Librarien" -> "Librarian"

To test, apply the patch and go to Administration -> System preferences
-> Cataloging.

 - Check the CreateAVFromCataloguing system preference.

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>
2 years agoBug 29158: (bug 22435 follow-up) Remove ref to account_offset_types.sql in intaller
Jonathan Druart [Mon, 25 Oct 2021 09:49:38 +0000 (11:49 +0200)]
Bug 29158: (bug 22435 follow-up) Remove ref to account_offset_types.sql in intaller

Caused by
  commit 3d6a6e79f79bfbc17807072faf0ff1d4e6aafb82
  Bug 22435: (follow-up) Drop account_offset_types table
that removes the file but the reference to it from the installer
process.

Test plan:
Go through the install process and notice that the following warning
does not appear in the log:
[2021/10/25 09:47:58] [WARN] Something went wrong loading file /kohadevbox/koha/installer/data/mysql/mandatory/account_offset_types.sql (Couldn't read '/kohadevbox/koha/installer/data/mysql/mandatory/account_offset_types.sql' : No such file or directory at /usr/share/perl5/DBIx/RunSQL.pm line 180.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14957: DBRev 21.06.00.038
Jonathan Druart [Tue, 26 Oct 2021 13:49:59 +0000 (15:49 +0200)]
Bug 14957: DBRev 21.06.00.038

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14957: DBIC schema changes
Jonathan Druart [Tue, 26 Oct 2021 13:46:22 +0000 (15:46 +0200)]
Bug 14957: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 14957: Add tests for subfield order
Jonathan Druart [Thu, 21 Oct 2021 13:51:50 +0000 (15:51 +0200)]
Bug 14957: Add tests for subfield order

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>