koha.git
2 years agoBug 29212: Use Flatpickr on OPAC pages
Owen Leonard [Wed, 13 Oct 2021 17:51:08 +0000 (17:51 +0000)]
Bug 29212: Use Flatpickr on OPAC pages

This patch adds Flatpickr assets to the OPAC (JS and SCSS). A few pages
are updated to use Flatpickr instead of jQueryUI datepickers.

jQueryUI CSS files are updated because they contain some font family
definitions which are simple to remove but overly complicated to
override. Without this change some Font Awesome icons are broken when
they appear inside jQueryUI widgets like tabs.

We don't run the risk of having this change overwritten by a future
jQueryUI upgrade because there won't be any more.

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

- Log into the OPAC and check that date pickers on the following pages
  work correctly, including month selection, year selection, forward
  and back arrows, and "Clear date" controls:
- Go to the "Your personal details" page.
- Check the "Date of birth" field.
- With SuspendHoldsOpac enabled, view the "Your summary" page for a
  patron with pending holds.
- Click "Suspend" to confirm that the "Suspend until" datepicker
  works correctly for more than one hold.
- From the catalog search results page, select multiple results and
  click the "Place hold" link.
- On the hold confirmation page, click "Show more options" to test
  the "Hold starts on date" (with OPACAllowHoldDateInFuture enabled)
  and the "Hold not needed after" fields.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19865: Add back horizontal scroll bar
Lucas Gass [Thu, 20 Jan 2022 21:45:49 +0000 (21:45 +0000)]
Bug 19865: Add back horizontal scroll bar

To test:
1. Do a Z39.50/SRU search
2. In the search results click on MARC to get the MARC preview. Choose
   something with lots of MARC data so it is both wide and long.
3. See the Y axis scrollbar
4. You must scroll bottom of the modal to see the X axis scrollbar,
   annoying.
5. Apply patch
6. Try steps 1-4 again. This time you should see the X axis scrollbar
   without having to scroll to the bottom.
7. It's not a bad idea to test in multiple browsers.

Note: I also put the CSS onto multiple lines to increase readability

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29895: Fix 'add multiple items' button on neworderempty
Jonathan Druart [Mon, 17 Jan 2022 14:01:56 +0000 (15:01 +0100)]
Bug 29895: Fix 'add multiple items' button on neworderempty

Button [Add multiple items] stops responding when it's pressed and some multiple items added to basket

It has a "visibility: hidden" we are trying to remove setting "display:
inline"

This is pretty ugly and certainly does not clean the code, but it's too
messy and this patch fixes the problem easily.

Test plan:
Add a new order
Click "Add multiple items", enter "2", click "Add".
Confirm that you can use the "Add multiple items" again.

Signed-off-by: Samu Heiskanen <samu.heiskanen@hypernova.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29809: Fix StockRotationStages.t
Jonathan Druart [Thu, 27 Jan 2022 16:13:32 +0000 (17:13 +0100)]
Bug 29809: Fix StockRotationStages.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29809: (follow-up) Update tests and rename variable
Nick Clemens [Tue, 18 Jan 2022 11:55:59 +0000 (11:55 +0000)]
Bug 29809: (follow-up) Update tests and rename variable

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29809: Update stockration tool to reflect method name change
Martin Renvoize [Thu, 6 Jan 2022 13:58:26 +0000 (13:58 +0000)]
Bug 29809: Update stockration tool to reflect method name change

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29809: Rename item relation accessor from itemnumber
Martin Renvoize [Thu, 6 Jan 2022 13:49:37 +0000 (13:49 +0000)]
Bug 29809: Rename item relation accessor from itemnumber

This patch renames the item relation accessor method in
StockRotationItem to 'item' from 'itemnumber' to more clearly reflect
that the method returns a Koha::Item object and not an itemnumber.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29906: (follow-up) Clarify actual code use
Martin Renvoize [Thu, 20 Jan 2022 15:15:14 +0000 (15:15 +0000)]
Bug 29906: (follow-up) Clarify actual code use

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29906: fix when hold record forcibly gets unwanted "suspended" state
Petro Vashchuk [Wed, 19 Jan 2022 16:01:15 +0000 (18:01 +0200)]
Bug 29906: fix when hold record forcibly gets unwanted "suspended" state

This code allows for "Perl false" to pass through to $suspended_until
if it is in $hold->suspend_until and in $body->{suspended_until}
But in case of "Perl truth" it calls dt_from_string for that value.

Reproduction:
1. run provided test in kshell: prove t/db_dependent/api/v1/holds.t
2. see the test fails with something like:
    #   Failed test 'Location change shouldn't touch suspended status'
    #   at t/db_dependent/api/v1/holds.t line 1067.
    #          got: '1'
    #     expected: '0'

    #   Failed test 'suspended_until should be undef'
    #   at t/db_dependent/api/v1/holds.t line 1068.
    #          got: '2022-01-20 00:00:00'
    #     expected: undef
    # Looks like you failed 2 tests of 39.
3. apply the changes in this patch to Koha/REST/V1/Holds.pm
4. run provided test in kshell: prove t/db_dependent/api/v1/holds.t
5. test will pass.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29862: Add missing txn begin/rollback in TestBuilder.t
Jonathan Druart [Mon, 17 Jan 2022 10:40:00 +0000 (11:40 +0100)]
Bug 29862: Add missing txn begin/rollback in TestBuilder.t

It fixes the tests when SearchEngine=ES
 t/db_dependent/TestBuilder.t .. 7/15 Invalid MARC field expression: l5ffglZ_upqqcwOvaiyALgXfyJw2Ot2AGRPUsiAPzSFHfd8J_hsnuQ8z75B8RKc_kyo2rFBp8BrPNwcM1FPhc01ngP01HU_Z7Rx1VHfcIcmrifYnjBDWNmYB9N5_4xEnxMH7ZhqC9b2Bz9wf9
 wSEmx64x6t5xFFKX at /kohadevbox/koha/C4/Biblio.pm line 306.
     # Looks like you planned 12 tests but ran 6.

 #   Failed test 'Tests for delete method'
 #   at t/db_dependent/TestBuilder.t line 302.
 Can't call method "biblionumber" on an undefined value at t/db_dependent/TestBuilder.t line 281.
 # Looks like your test exited with 11 just after 8.

Previous subtest created invalid date in the ES mappings.

Test plan:
Set SearchEngine=ES and run the tests, they must pass.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29779: Make selenium tests return green even if lib is missing
Jonathan Druart [Mon, 3 Jan 2022 11:38:29 +0000 (12:38 +0100)]
Bug 29779: Make selenium tests return green even if lib is missing

Some selenium tests are not correctly written and they fail is
Selenium::Remote::Driver is missing.

Test plan:
1. Remove the lib rm `pmpath Selenium::Remote::Driver`
2. prove t/db_dependent/selenium/
should return green

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29482: Replace the term branch with library
Owen Leonard [Tue, 18 Jan 2022 12:46:51 +0000 (12:46 +0000)]
Bug 29482: Replace the term branch with library

This patch replaces the word "branch" with the word "library" in the
self-checkout template, as per terminology guidelines.

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

- Set the "IndependentBranches" preference to "Yes."
- Log into the self checkout system using a staff user with permission
  to do self-checkout but not superlibrarian status.
- Try to check out an item which belongs to a library that's different
  to the one you're logged in with.
- You should see a message, "Item cannot be checked out," including the
  text "This item belongs to another library."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29562: (follow-up) typo $tem in opac-reserve.pl
Fridolin Somers [Tue, 1 Feb 2022 00:54:30 +0000 (14:54 -1000)]
Bug 29562: (follow-up) typo $tem in opac-reserve.pl

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29562: Test $item instead of $itemNum
Jonathan Druart [Mon, 10 Jan 2022 12:56:30 +0000 (13:56 +0100)]
Bug 29562: Test $item instead of $itemNum

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29562: Fix DecreaseLoanHighHolds.t
Jonathan Druart [Mon, 10 Jan 2022 12:39:35 +0000 (13:39 +0100)]
Bug 29562: Fix DecreaseLoanHighHolds.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29562: (follow-up) Fix API controller
Tomas Cohen Arazi [Mon, 10 Jan 2022 11:01:20 +0000 (08:01 -0300)]
Bug 29562: (follow-up) Fix API controller

This patch fixes tests failures due to bad checks in the controller.
The tests deserve to be rewritten.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29562: Adjust CanItemBeReserved and checkHighHolds to take objects
Nick Clemens [Tue, 23 Nov 2021 19:56:52 +0000 (19:56 +0000)]
Bug 29562: Adjust CanItemBeReserved and checkHighHolds to take objects

Most of the changes here are simple, this can be read to view the changes

Testing that holds can be placed via staff client, and opac, and are disallowed
when expected is the best test plan, beyond running the unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29058: Don't display 'Always show holds' at the bottom of the patron list
Jonathan Druart [Fri, 28 Jan 2022 12:47:35 +0000 (13:47 +0100)]
Bug 29058: Don't display 'Always show holds' at the bottom of the patron list

The checkbox should not appear if we are selecting a patron

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29058: Don't display 'Show holds' button if holds are displayed
Jonathan Druart [Fri, 28 Jan 2022 12:05:55 +0000 (13:05 +0100)]
Bug 29058: Don't display 'Show holds' button if holds are displayed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29058: Add missing filters
Jonathan Druart [Fri, 28 Jan 2022 12:52:28 +0000 (13:52 +0100)]
Bug 29058: Add missing filters

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29058: Add 'Always show holds' checkbox to request.pl
Nick Clemens [Mon, 20 Sep 2021 11:17:50 +0000 (11:17 +0000)]
Bug 29058: Add 'Always show holds' checkbox to request.pl

This patch adds a new cookie 'awalys_show_holds' and utlises it on request.pl
to determine if the existing holds table should be loaded.

If the cookie does not exist, the table is loaded to preserve exiting behaviour.
If the cookie exists and is set to 'DONT' a new button 'Show holds' is added to
the page to allow force loading the table

To test:
1 - Place some holds on a record
2 - Click 'Holds' tab or 'Place a hold' from details page
3 - Note search box to place hold and table of existing holds
4 - Apply patch
5 - Reload the holds page and note new checkbox 'Always show holds'
6 - Confirm the box is checked
7 - Uncheck it
8 - Reload the page and confirm holds do not automatically load
9 - Click the new 'Show holds' button
10 - Confirm the existing holds load, and that 'Always show holds' is unchecked
11 - Check 'Always show holds'
12 - Reload page and confirm holds don't show
13 - Uncheck the box, load holds for another record, confirm it remains unchecked
14 - Bring up browser console (F12)
15 - In 'Storage' tab, under 'Cookies', delete the cookie for 'always_show_holds'
16 - Reload holds page, confirm holds load and check box is checked

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Bug 29058: (follow-up) Add hold count and don't display show options if no holds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29043: Don't fetch items if when are not on the 'Place a hold on' form
Jonathan Druart [Mon, 17 Jan 2022 14:18:13 +0000 (15:18 +0100)]
Bug 29043: Don't fetch items if when are not on the 'Place a hold on' form

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29043: Don't fetch biblios info unless a patron is picked
Jonathan Druart [Fri, 14 Jan 2022 16:15:31 +0000 (17:15 +0100)]
Bug 29043: Don't fetch biblios info unless a patron is picked

If we haven't picked a patron or a club yet we don't need to fetch
biblios, items and holdability infos

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29759: (QA follow-up) Remove abs from the test
Marcel de Rooy [Tue, 11 Jan 2022 14:31:27 +0000 (14:31 +0000)]
Bug 29759: (QA follow-up) Remove abs from the test

Obviously abs has two sides, and we could allow wrong results. We
can be more precise here.
Trivial exercise.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29759: Make cancelling an AR refund
Tomas Cohen Arazi [Wed, 22 Dec 2021 21:17:37 +0000 (18:17 -0300)]
Bug 29759: Make cancelling an AR refund

This patch makes the Koha::ArticleRequest->cancel method perform a
refund if it applies.

The sequence is:
- Find refundable (potentially partial) payments against the fee
- Generate a refund for the refundable amount
- Reduce the fee to zero
=> RESULT: the patron owes nothing, any credits applied to the debit are
refunded.

1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/ArticleRequest.t
=> FAIL: Nothing is refunded
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Refunds take place!
5. Try on the UI
=> SUCCESS: All good
6. 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: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29759: Unit tests
Tomas Cohen Arazi [Wed, 22 Dec 2021 21:17:10 +0000 (18:17 -0300)]
Bug 29759: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29511: Sort hash keys
Nick Clemens [Tue, 23 Nov 2021 13:39:57 +0000 (13:39 +0000)]
Bug 29511: Sort hash keys

This code exists in authorities/authorities.pl and the hash keys are sorted
I just do the same here

To test:
1 - Find/create a record with 245a 245h populated
2 - Load/reload the record several times and note that fields c and b are ordered randomly
3 - Apply patch
4 - Reload and note c and b are ordered alphabetically
5 - Move subfield h before subfield c
6 - Save and reload
7 - Confirm that existing/filled fields retain order in the MARC record

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21652: Simplify code
Jonathan Druart [Thu, 20 Jan 2022 10:20:49 +0000 (11:20 +0100)]
Bug 21652: Simplify code

And add a test.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21652: Only set waitingdate to today if there is no waitingdate already
Lucas Gass [Thu, 6 Jan 2022 15:16:05 +0000 (15:16 +0000)]
Bug 21652: Only set waitingdate to today if there is no waitingdate already

1- Find or create a hold with a waitingdate other than today
2- Check the item in to generate a new hold alert
3- Select "Confirm and Print"
4- Verify that the waiting date has changed to the current date
5- Apply patch
6- Try 1-3 again, if a waitingdate already exists it should not change
7. Try an item with no waitingdate, it should properly update to today

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21652: Unit test
Nick Clemens [Fri, 14 Jan 2022 14:17:02 +0000 (14:17 +0000)]
Bug 21652: Unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29320: Update OverDrive availability to V2
Nick Clemens [Tue, 26 Oct 2021 11:22:04 +0000 (11:22 +0000)]
Bug 29320: Update OverDrive availability to V2

This patch updates the call to overdrive_proxy to allow passing a version
and updates the code to use V2 for availability

To test:
1 - Enable OverDrive integration by setting the sysprefs
2 - Log in to your overdrive account in the Koha opac
3 - Perform a search and note availability display
4 - Confirm you can checkout/hold/return books
5 - Apply patch
6 - Repeat search and test functionality
7 - Note that title with '0 out of 0 copies available' now say 'Currently unavailable'

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29690: Prevent detail.pl to crash if MARCXML is invalid
Jonathan Druart [Thu, 13 Jan 2022 05:21:15 +0000 (06:21 +0100)]
Bug 29690: Prevent detail.pl to crash if MARCXML is invalid

Bug 23846 added support for invalid MARCXML.
But now page details.pl fails again with software error.
This comes from several Koha::Biblio calling $self->metadata->record without eval.

Test plan :
1) Create a biblio record with invalid MARCXML (see Bug 29690)
In koha-testing-docker there is biblionumber=369
2) Go to page cgi-bin/koha/catalogue/detail.pl?biblionumber=xxx
3) You see the page with a message :
There is an error with this bibliographic record, the view may be degraded.
Error: Invalid data, cannot decode metadata object ...

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29690: Add selenium test
Jonathan Druart [Wed, 15 Dec 2021 07:24:16 +0000 (08:24 +0100)]
Bug 29690: Add selenium test

Run prove t/db_dependent/selenium/regressions.t on KTD with selenium

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29757: (RM follow-up) More POD fixes
Fridolin Somers [Sat, 29 Jan 2022 06:40:17 +0000 (20:40 -1000)]
Bug 29757: (RM follow-up) More POD fixes

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29757: (QA follow-up) POD fixes
Tomas Cohen Arazi [Wed, 22 Dec 2021 19:49:43 +0000 (16:49 -0300)]
Bug 29757: (QA follow-up) POD fixes

This patch adds POD, fixes the existing one in the file, and also
renames reversable => reversible as required by the QA scripts.

If this name change is problematic, I can revert it and resubmit my
follow-up.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29757: Add filters for reversable offsets
Martin Renvoize [Wed, 22 Dec 2021 19:36:07 +0000 (16:36 -0300)]
Bug 29757: Add filters for reversable offsets

This patch adds filtering methods for (non)reversable offsets.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29757: Unit tests
Tomas Cohen Arazi [Wed, 22 Dec 2021 19:06:35 +0000 (16:06 -0300)]
Bug 29757: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 6734: (QA follow-up) Fix punctuation, TT filters, and CSS class
Katrin Fischer [Sun, 9 Jan 2022 10:49:44 +0000 (10:49 +0000)]
Bug 6734: (QA follow-up) Fix punctuation, TT filters, and CSS class

* Changes Location : to Location:
* Removes html_line_break filter, as location is not multi-line
* Add subscription_location CSS class
* Use AuthorisedValues.GetDescriptionByKohaField()

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=6743
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 6734: Show location in serials history table
jeremy breuillard [Thu, 16 Dec 2021 16:59:03 +0000 (17:59 +0100)]
Bug 6734: Show location in serials history table

Opac: On a record(Serials) details the location wasn't displayed on the "Normal view" and "Full history" tabs

Test plan:
1)Intranet: Make sure to have at least two different Serials/Subscriptions on the same record with the field 'location' filled in
2)Opac: Find your Serials/Subscriptions
3)Click 'More details' and notice the 3 tabs : Normal view, Brief history, Full history
4)Go to 'Normal view' and 'Full history' to notice that 'location' is missing
5)Apply patch, refresh your browser & repeat 4)
6)The location is now visible

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29458: Reorder login elements
Marcel de Rooy [Thu, 11 Nov 2021 13:45:25 +0000 (13:45 +0000)]
Bug 29458: Reorder login elements

Make masthead.inc modal and opac-auth follow the order of the login
elements on the homepage.

Test plan:
Enable prefs for reset password and self registration.
Fill additional contents for login instructions.
Logout on OPAC.
Click Login from your account on top bar.
Click Login button on the home page (right side, in the middle).
Verify that these two forms correspond with the home page login.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 29458: (follow-up) Remove FIXME

With some help of Owen Leonard:
<oleonard> Regarding the <br/>, you can wrap the submit button in <fieldset class="action"></fieldset> instead.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29899: Show public note to patrons when placing a hold
Owen Leonard [Tue, 18 Jan 2022 17:57:22 +0000 (17:57 +0000)]
Bug 29899: Show public note to patrons when placing a hold

This patch adds public note to the table of information shown about
items when placing a hold on a specific item in the OPAC.

To test, apply the patch and check Administration -> Circulation and
fine rules. You should have at least one patron category/item type
configured to allow OPAC item level holds.

- Modify an item to add information to the "Public note" field.
- Locate that record in the OPAC and place a hold on it.
- On the "Placing hold" page, click "Show more options" and "A specific
  item."
- In the table of items you should see a "Notes" column showing the
  information you added to the item.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29629: Remove two unused MODS XSLT stylesheets
Marcel de Rooy [Fri, 3 Dec 2021 08:14:48 +0000 (08:14 +0000)]
Bug 29629: Remove two unused MODS XSLT stylesheets

Follow-up of bug 29556. With thanks to Owen for checking.

> koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2MODS3.xsl
> koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2MODS32.xsl
> These two files appear to be unused. I could only find references to them in .po files.

Test plan:
git grep MARC21slim2MODS32
git grep MARC21slim2MODS3
Skip the misc/translator/po references. Note in the second grep that
you only see that MODS3-1 is used in unapi and C4::Record.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27868: Add expiration date to holds awaiting pickup
Lucas Gass [Tue, 7 Dec 2021 22:14:07 +0000 (22:14 +0000)]
Bug 27868: Add expiration date to holds awaiting pickup

To test:
1. Have some holds awaiting pickup, also have some holds that have been waiting longer than the ReservesMaxPickUpDelay is set to.
2. Go to /cgi-bin/koha/circ/waitingreserves.pl
3. There is no expiration date
4. Apply patch and restart_all
5. Now there should be a Expiration date column, make sure you can see it in both Holds waiting and Holds waiting over X days
6. Make sure all the columns Waiting Since, Date hold placed, and expiration date still sort correctly
6. Go to Table settings, and make sure all the columns hide correctly for both of the  holds_awaiting_pickup tables ( holdst & holdso )

Note: This patch also corrects 2 other small problems

1. Corrects a problem where the table settings did not account for the checkbox column at the beginnning of each table
2. Removes the title-string class and uses data-order to sort Waiting Since, Date hold placed, and expiration date ( see Bug 27934 )

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28238: (follow-up) Add itemcallnumber to ILS-DI GetAvailability output for unavai...
Marion Durand [Fri, 24 Sep 2021 07:15:37 +0000 (09:15 +0200)]
Bug 28238: (follow-up) Add itemcallnumber to ILS-DI GetAvailability output for unavailable items

Providing the call number for ILS-DI GetAvailability output is useful
for libraries that use discovery tools. Patrons often don't check
further for the call number, and then they don't have it when they look
for the item. It could also be use full to have this call number when
the item isn't available (to make a request for it for instance).

Test plan:
1. Enable the ILS-DI system preference
2. Locate a record with multiple items and make sure they have call
   numbers for each item and that some are unavailable
3. Test these URLs:
   [OPACBASEURL]/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=[BIBLIONUMBER]&id_type=biblio
   and
   [OPACBASEURL]/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=[ITEMNUMBER]&id_type=item
   (Where the [OPACBASEURL] is the OPAC URL of your test instance,
   [BIBLIONUMBER] and [ITEMNUMBER] are a record number and item number of
   your choice.)
4. Apply the patch
5. Run the queries from step 3 again - all the results should now have
   the tag itemcallnumber (not only the available's ones)
   Example: <dlf:itemcallnumber>840.08 COR R</dlf:itemcallnumber>

Sponsored-by: University Lyon 3
https://bugs.koha-community.org/show_bug.cgi?id=28238

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28238: Add itemcallnumber to ils-di GetAvailability output
Lyon3 Team [Tue, 27 Apr 2021 14:13:39 +0000 (16:13 +0200)]
Bug 28238: Add itemcallnumber to ils-di GetAvailability output

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28238: Add tests
Marion Durand [Tue, 9 Nov 2021 11:04:34 +0000 (11:04 +0000)]
Bug 28238: Add tests

Add specific tests for the tag itemcallnumber in GetAvailability output.

Sponsored-by: University Lyon 3
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29875: Update wording on maxreserves system preference
Andrew Fuerste-Henry [Thu, 13 Jan 2022 19:17:06 +0000 (19:17 +0000)]
Bug 29875: Update wording on maxreserves system preference

To test:
1 - see the current wording
2 - apply patch
3 - words are changed

Test to confirm accuracy of wording:
1 - set maxreserves to 1
2 - set all/all circ rule to unlimited holds allowed total, holds allowed daily, and holds per record
3 - confirm you can place 1 hold for a patron, but the second is blocked
4 - set maxreserves to 0
5 - confirm you can place and number of holds for the patron
6 - set maxreserves to blank
7 - confirm you can place any number of holds for the patron

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: DBRev 21.12.00.011
Fridolin Somers [Fri, 28 Jan 2022 20:32:00 +0000 (10:32 -1000)]
Bug 27946: DBRev 21.12.00.011

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: Update DBIC schema
Fridolin Somers [Fri, 28 Jan 2022 20:22:24 +0000 (10:22 -1000)]
Bug 27946: Update DBIC schema

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: (QA follow-up) Remove 'scan' terminology, requests may not be scans
Kyle Hall [Fri, 7 Jan 2022 12:04:24 +0000 (07:04 -0500)]
Bug 27946: (QA follow-up) Remove 'scan' terminology, requests may not be scans

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: Add UI handling of AR fees
Tomas Cohen Arazi [Fri, 17 Dec 2021 13:32:04 +0000 (10:32 -0300)]
Bug 27946: Add UI handling of AR fees

This patch:
- Adds a notice about the fee to be charged to the patron (staff and
  OPAC)
- Adds the right UI description for ARTICLE_REQUEST_FEE debit types in
  the UI.

To test:
1. Have some article request fee rules
2. Play with placing an article request in OPAC and staff
=> SUCCESS: You see a message about the fee
=> SUCCESS: The fees are correctly applied to the patron
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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: Make Koha::ArticleRequest->request add a fee if required
Tomas Cohen Arazi [Fri, 17 Dec 2021 13:29:53 +0000 (10:29 -0300)]
Bug 27946: Make Koha::ArticleRequest->request add a fee if required

This patch makes the ->request method add a fee for the patron if
required. It relies on methods defined in Koha::Patron for the task. The
debit line is linked to the AR if applies.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/ArticleRequest.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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: Article request fee methods in Koha::Patron
Tomas Cohen Arazi [Fri, 17 Dec 2021 13:18:53 +0000 (10:18 -0300)]
Bug 27946: Article request fee methods in Koha::Patron

This patch adds article_request_fee() and add_article_request_fee_if_needed() methods to Koha::Patron.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: Add article request fee to circulation rules
Tomas Cohen Arazi [Mon, 8 Nov 2021 18:32:36 +0000 (15:32 -0300)]
Bug 27946: Add article request fee to circulation rules

This patch adds a new circulation rule: article requests fee.

It can be set per library and category.

To test:
1. Try setting sdifferent numeric values, change, and delete them
=> SUCCESS: Things work as expected
2. Make sure rules are loaded correctly when re-entering the circ rules
   page
=> SUCCESS: All good
3. Verify the data on the DB is stored as it should on each of your
   tests:
   $ koha-mysql kohadev
   > SELECT * FROM circulation_rules \
     WHERE rule_name='article_request_fee';
=> SUCCESS: All good (remember NULL => 'All' in the UI)
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27946: Add article_requests.debit_id and ARTICLE_REQUEST account debit type
Tomas Cohen Arazi [Mon, 8 Nov 2021 18:29:14 +0000 (15:29 -0300)]
Bug 27946: Add article_requests.debit_id and ARTICLE_REQUEST account debit type

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21729: Update DBIC schema
Fridolin Somers [Fri, 28 Jan 2022 20:08:48 +0000 (10:08 -1000)]
Bug 21729: Update DBIC schema

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21729: DBRev 21.12.00.010
Fridolin Somers [Fri, 28 Jan 2022 20:06:43 +0000 (10:06 -1000)]
Bug 21729: DBRev 21.12.00.010

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21729: Add tests
Jonathan Druart [Mon, 20 Dec 2021 15:03:46 +0000 (16:03 +0100)]
Bug 21729: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21729: Simplify non-existent expiration date
Jonathan Druart [Thu, 14 Oct 2021 06:38:02 +0000 (08:38 +0200)]
Bug 21729: Simplify non-existent expiration date

No change in behaviour expected by this patch.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Florian Bontemps <florian.bontemps@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21729: Keep expiration date set when placing a hold
Jonathan Druart [Wed, 13 Oct 2021 09:30:42 +0000 (11:30 +0200)]
Bug 21729: Keep expiration date set when placing a hold

The expiration date picked by the patron (or librarian) when placing a
hold is lost when a waiting hold is reverted.

We need a separate DB field to store this value and restore it when
needed: patron_expiration_date

The new behaviours are now:
Create a hold and specify an expiration date:
  expirationdate=patron_expiration_date

Fill the hold:
  expiration_date is calculated
  expiration_date set to the calculated value or to
patron_expiration_date if anterior
  patron_expiration_date not modified

Revert the waiting status:
  expirationdate set back to patron_expiration_date

Cancel expire reserves:
  if < expirationdate OR < patron_expiration_date
Note: This change should not be needed but won't hurt

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Florian Bontemps <florian.bontemps@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 21729: DB changes
Jonathan Druart [Wed, 13 Oct 2021 09:02:24 +0000 (11:02 +0200)]
Bug 21729: DB changes

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Florian Bontemps <florian.bontemps@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29481: Terminology: Fix other occurrences of 'Collection code'
Katrin Fischer [Sat, 18 Dec 2021 21:04:16 +0000 (22:04 +0100)]
Bug 29481: Terminology: Fix other occurrences of 'Collection code'

This changes "collection code" to be "collection" as Koha displays
the collection description and no codes. This will also help to make
the GUI more consistent overall.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29481: Terminology: Collection code, call number
Owen Leonard [Tue, 16 Nov 2021 19:48:29 +0000 (19:48 +0000)]
Bug 29481: Terminology: Collection code, call number

This patch corrects an instance of the phrase "Collection code,"
replacing it with the standard "Collection."

To test, apply the patch and restart services.

- In the staff interface, go to Administration -> System preferences and
  set the OpacItemLocation preference to "library, collection code, and
  call number."
- In the OPAC, search the catalog using a term which will return
  multiple results.
- In the search results, item descriptions in the "Availability" line
  should read like this:

  [Collection, call number: Non-fiction 394.2663 Bu]

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>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29686: Adapt Koha to use new fulfillment API for OverDrive
Nick Clemens [Mon, 13 Dec 2021 13:08:28 +0000 (13:08 +0000)]
Bug 29686: Adapt Koha to use new fulfillment API for OverDrive

This patch modifies the checkout_download_url routine in
WebSerivce::ILS::OverDrive::Patron

We now directly hit the fulfillment endpoint with redirects disabled
and fetch the URL

The overdrive.js is modified to use a single 'Get item' button for all
checked out items and to refer to the fulfillment page

To test:
1 - Enable all OverDrive system preferences
2 - Search on opac and confirm OD results returned
3 - Checkout an item
4 - Confirm you have the new 'Get item' button on 'OverDrive account'
    tab on opac-user.pl
5 - Confirm the 'Get item' button works

NOTE:
Most items will also show the 'Get item' button in results, however,
magazines may not as each checkout has a unique 'reserve id' and the
'parent' id is not checked in our current code

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29403: (QA follow-up) Add comments why test should fail
Marcel de Rooy [Fri, 14 Jan 2022 10:19:02 +0000 (10:19 +0000)]
Bug 29403: (QA follow-up) Add comments why test should fail

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29403: Fix unit test for bug 29718
Martin Renvoize [Tue, 21 Dec 2021 11:44:44 +0000 (11:44 +0000)]
Bug 29403: Fix unit test for bug 29718

Including a 'T' is actually valid for ISO date format, I was being
naughty and writing the test to follow our code rather than writing the
test to conform to the ISO spec first time around. Now we are properly
supporting 'T' in ISO dates with bug 29718, we need to update the test
here to properly reflect an invalid ISO date string.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
The commit message is misleading here. Look at the Z in the code changes.
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29403: Fix api/v1/patrons.t
Martin Renvoize [Wed, 3 Nov 2021 13:41:44 +0000 (13:41 +0000)]
Bug 29403: Fix api/v1/patrons.t

t::lib::Dates::compare expects either correct DateTime objects, or a
system formatted datetime strings to be passed.. but as we're testing
the API, we are consistently using RFC3339 strings for date-times and
ISO8601 strings for dates.  We need to therefore pre-process the strings
into DateTime objects for the comparison.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29403: Match the whole string
Martin Renvoize [Wed, 3 Nov 2021 12:15:18 +0000 (12:15 +0000)]
Bug 29403: Match the whole string

This patch wraps the constructed regex such that we expect the entire
regex to match and don't allow leading or trailing garbage.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29403: Unit tests
Martin Renvoize [Wed, 3 Nov 2021 12:14:50 +0000 (12:14 +0000)]
Bug 29403: Unit tests

Add a unit test for proper iso date handling

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29718: (QA follow-up) ISO 8601 allows +02 and +0200
Marcel de Rooy [Fri, 14 Jan 2022 09:07:58 +0000 (09:07 +0000)]
Bug 29718: (QA follow-up) ISO 8601 allows +02 and +0200

The UTC offset is appended to the time in the form:
    ±[hh]:[mm], ±[hh][mm], or ±[hh]

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29718: (QA follow-up) Remove duplicate test
Martin Renvoize [Thu, 13 Jan 2022 09:06:55 +0000 (09:06 +0000)]
Bug 29718: (QA follow-up) Remove duplicate test

I'd inadvertantly introduced the exact same test twice!  This patch
removes the duplicate and annotates the test to clarify the timezone
handling expectations.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29718: Mock the timezone
Jonathan Druart [Thu, 13 Jan 2022 05:58:18 +0000 (06:58 +0100)]
Bug 29718: Mock the timezone

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29718: Unit tests
Martin Renvoize [Tue, 21 Dec 2021 13:49:29 +0000 (13:49 +0000)]
Bug 29718: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29718: (QA follow-up) Add optional offset handling
Martin Renvoize [Fri, 17 Dec 2021 12:36:20 +0000 (12:36 +0000)]
Bug 29718: (QA follow-up) Add optional offset handling

ISO8601 optionally supports timezone offsets. If a timezone is ommited,
we should assume 'local' time (Which in our case is instance
configuration time), if we are passed 'Z' or 'z' we should set timezone
to 'UTC', otherwise we should set the timezone to the passed offset.

Whilst ISO8601 does NOT support AM/PM, I left that intact as it has
historical relevance in Koha and we share the ISO parsing with SQL type
parsing amongth other things.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29718: (QA follow-up) Make 'T' check case insensative
Martin Renvoize [Fri, 17 Dec 2021 12:20:20 +0000 (12:20 +0000)]
Bug 29718: (QA follow-up) Make 'T' check case insensative

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29718: Support ISO8601
Jonathan Druart [Thu, 16 Dec 2021 15:58:45 +0000 (16:58 +0100)]
Bug 29718: Support ISO8601

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28962: Add del-unv-selfreg to crontab
Marcel de Rooy [Tue, 7 Sep 2021 14:14:44 +0000 (14:14 +0000)]
Bug 28962: Add del-unv-selfreg to crontab

We also add a test by inserting a simulated borrower modification
record in the same table which should not be deleted.

NOTE: This patch fixes the del-unv-selfreg parameter in the
cleanup db script. It did not even do what it promised :)

Test plan:
Verify if the crontab change is correct.
Run t/db_dependent/Members.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29722: (QA follow-up) Replace unusual single quote
Fridolin Somers [Sat, 22 Jan 2022 06:45:27 +0000 (20:45 -1000)]
Bug 29722: (QA follow-up) Replace unusual single quote

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29722: Add more sample quotes
Aleisha Amohia [Fri, 17 Dec 2021 02:48:42 +0000 (02:48 +0000)]
Bug 29722: Add more sample quotes

This patch adds sample quotes from women, women of colour, trans women,
Black and Indigenous women, and people who weren't US Presidents!

To test:
1. Install a fresh Koha and import sample quotes
2. Go to Tools -> Quote editor
3. Confirm the quotes show

Sponsored-by: Catalyst IT
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29054: Add verbose check for warn in advance_notices.pl
Hayley Pelham [Mon, 20 Sep 2021 04:23:11 +0000 (04:23 +0000)]
Bug 29054: Add verbose check for warn in advance_notices.pl

To test:
1) Set EnhancedMessagingPreferences to Don't allow
2) In the koha-shell, run misc/cronjobs/advance_notices.pl -c
3) Note that you see the warning "The "EnhancedMessagingPreferences"
syspref is off... etc."
4) Apply the patch and restart services
5) In the koha-shell, run misc/cronjobs/advance_notices.pl -c and note
the warning no longer shows
6) Still in the shell, run misc/cronjobs/advance_notices.pl -c -v and
note the warning does show

Sponsored-by: Catalyst IT
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29397: Add .kohaSelect select2 wrapper function
Martin Renvoize [Wed, 3 Nov 2021 14:37:11 +0000 (14:37 +0000)]
Bug 29397: Add .kohaSelect select2 wrapper function

This patch adds a kohaSelect wrapper function to simplify
paging/infinite scrolling with select2 using the Koha RESTful api's.

Invoke select2 select boxes as you normally would from JS, but instead
of calling .select2(config) use .kohaSelect(config).

If an 'ajax' property is defined in your config object, we wrap the
transport such that responses include a pagination key as expected by
select2.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29797: Fix display of itemnumbers on the background job detail view
Jonathan Druart [Wed, 5 Jan 2022 09:38:27 +0000 (10:38 +0100)]
Bug 29797: Fix display of itemnumbers on the background job detail view

If some items have not been deleted, the detail view of the background job will display "1 item(s) could not be deleted: ", without the list of itemnumbers.
Also add a space character between itemnumbers.

Test plan:
1. Check an item out
2. Use the batch delete items tool to delete the item that is checked
out and another one.
3. On the confirmation view, use the dev tool of your browser to remove
the "disabled" property of the disabled checkbox and select both
items.
4. Submit
5. Go to the detail view of the background job and confirm that you see
the itemnumber of the item that has failed to be deleted

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29156: File missing warning in Koha::UploadedFile for permanent files only
Fridolin Somers [Fri, 1 Oct 2021 23:06:57 +0000 (13:06 -1000)]
Bug 29156: File missing warning in Koha::UploadedFile for permanent files only

When an uploaded file is deleted, when file does not exist there is a warning :
"Removing record for file.txt within category koha_upload, but file was missing."

For temporary files, this warning is noisy.
For example when they are in /tmp, system reboot deleted them.

I propose to remove this warning for temporary files.

Test plan :
1) Upload a temporary and a permanent file via Tools > Upload
2) Delete the file on server
3) Delete the two files from Tools > Upload
4) Look at warning in log files
=> You see only warning for permanent file

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29837: Remove JS error during installer
Jonathan Druart [Mon, 10 Jan 2022 09:35:40 +0000 (10:35 +0100)]
Bug 29837: Remove JS error during installer

Uncaught ReferenceError: _ is not defined

the _() function is called from calendar.inc, but calendar.inc is
 included before the definition of this function in
installer-intranet-bottom.inc

Test plan:
Confirm that the JS error is gone

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28943: (QA follow-up) Fix opac.pref
Fridolin Somers [Sat, 22 Jan 2022 01:57:28 +0000 (15:57 -1000)]
Bug 28943: (QA follow-up) Fix opac.pref

Fix YAML syntax of opac.pref, we must use dash for new lines.

Also removes duplicate text before syspref.
No need to say "code" since it is now a list of categories.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28943: Lower the risk of accidental patron deletion
Marcel de Rooy [Tue, 7 Sep 2021 12:22:05 +0000 (12:22 +0000)]
Bug 28943: Lower the risk of accidental patron deletion

If you do not use a temporary self registration patron category,
you should actually make the preference
PatronSelfRegistrationExpireTemporaryAccountsDelay empty.

As the comment in sysprefs.sql already said, we should not let
a zero value in the pref delete patrons too.

The module is changed now, the test adjusted and
the description of both related sysprefs modified.

Test plan:
Run t/db_dependent/Members.t
Check in Administration the two adjusted OPAC pref descriptions.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29840: Deal with non-existing biblionumber in opac-reserve
Jonathan Druart [Mon, 10 Jan 2022 13:02:49 +0000 (14:02 +0100)]
Bug 29840: Deal with non-existing biblionumber in opac-reserve

We should not explode if the biblionumber passed in not in DB.

Test plan:
Hit /cgi-bin/koha/opac-reserve.pl?biblionumber=42424
and notice the error message.

Without this patch you got
Can't call method "holds" on an undefined value at
/kohadevbox/koha/opac/opac-reserve.pl line 172

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29838: Fix string interpolation in ImportBatch.t
Jonathan Druart [Mon, 10 Jan 2022 10:34:27 +0000 (11:34 +0100)]
Bug 29838: Fix string interpolation in ImportBatch.t

Test plan:
Tests should return green

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29865: Fix duplicate includes in circ/returns.pl
Tomas Cohen Arazi [Wed, 12 Jan 2022 18:21:46 +0000 (15:21 -0300)]
Bug 29865: Fix duplicate includes in circ/returns.pl

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29646: (RM follow-up) Add space before colon
Fridolin Somers [Sat, 22 Jan 2022 00:58:42 +0000 (14:58 -1000)]
Bug 29646: (RM follow-up) Add space before colon

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29646: Fix undefined category crash in opac-password-recovery
Marcel de Rooy [Mon, 6 Dec 2021 08:31:48 +0000 (08:31 +0000)]
Bug 29646: Fix undefined category crash in opac-password-recovery

The crash is a result of a not found borrower. This is typically
a bad or repeated recovery attempt.

Test plan:
Do a password recovery.
Use the mailed URL twice.
Without this patch, the second attempt crashes.
With this patch, the second attempt shows an error dialog.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 11750: (QA follow-up) Remove unconditional warn
Katrin Fischer [Sat, 8 Jan 2022 23:05:00 +0000 (23:05 +0000)]
Bug 11750: (QA follow-up) Remove unconditional warn

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 11750: Hide patron's attributes on overdue list if needed
Jonathan Druart [Thu, 19 Aug 2021 12:01:17 +0000 (14:01 +0200)]
Bug 11750: Hide patron's attributes on overdue list if needed

If a patron's attributes is limited to some libraries, we must apply
this limit on the overdue list view.

Test plan:
1. Create the following patron attributes:
A that is not searchable
B is searchable and does not have library limitation
C is searchable and is limited to another library than yours
2. On the right part of the overdue list view you must see B only
Without this patch C is displayed as well.

Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29764: Fix incorrect EmbedItems RecordProcessor filter POD
Tomas Cohen Arazi [Thu, 23 Dec 2021 11:41:33 +0000 (08:41 -0300)]
Bug 29764: Fix incorrect EmbedItems RecordProcessor filter POD

This patch makes the usage POD for the EmbedItems filter actually be
usable. The filter is used in opac-ISBDdetail.pl and the POD is updated
to how it is used there.

Not much to test.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29806: (follow-up) Call ->as_list for ->pickup_locations on request.pl
Jonathan Druart [Fri, 7 Jan 2022 14:54:16 +0000 (15:54 +0100)]
Bug 29806: (follow-up) Call ->as_list for ->pickup_locations on request.pl

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29806: Fix POST /holds use of pickup_locations
Tomas Cohen Arazi [Thu, 6 Jan 2022 12:27:45 +0000 (09:27 -0300)]
Bug 29806: Fix POST /holds use of pickup_locations

This patch makes Koha::Item->pickup_locations and
Koha::Biblio->pickup_locations explicitly call ->as_list in list
context. This way we workaround bug 28871.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail, the route gives a 500 (unhandled exception)
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass, the route correctly returns a 400 with a
message about the pickup location being invalid
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29806: Call ->as_list for ->pickup_locations on request.pl
Tomas Cohen Arazi [Thu, 6 Jan 2022 12:22:05 +0000 (09:22 -0300)]
Bug 29806: Call ->as_list for ->pickup_locations on request.pl

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29806: Regression tests
Tomas Cohen Arazi [Thu, 6 Jan 2022 12:27:28 +0000 (09:27 -0300)]
Bug 29806: Regression tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29807: Make Branches plugin handle empty pickup locations list
Tomas Cohen Arazi [Thu, 6 Jan 2022 11:53:30 +0000 (08:53 -0300)]
Bug 29807: Make Branches plugin handle empty pickup locations list

This patch makes the plugin handle empty Koha::Biblio->pickup_locations
and Koha::Item->pickup_locations correctly.

It does so by explicitly calling ->as_list. It also restores the logic
that was changed by 6cd1ffab4e491349c99769018a7df33dc8a8aabf so, now
that ->empty is handled correctly, it doesn't return ALL the pickup
locations when the item/biblio doesn't have valid pickup locations.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Template/Plugin/Branches.t
=> FAIL: Awful error
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29807: Regression tests
Tomas Cohen Arazi [Thu, 6 Jan 2022 11:53:01 +0000 (08:53 -0300)]
Bug 29807: Regression tests

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>