koha.git
23 months agoBug 30876: Fix wrong call to ->search in list context
Tomas Cohen Arazi [Wed, 1 Jun 2022 11:16:00 +0000 (08:16 -0300)]
Bug 30876: Fix wrong call to ->search in list context

The code is clearly incorrect as ->search no longer returns a list when
called in list context.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23 months agoBug 30756: (follow-up) Restore MARC21 authority file
Tomas Cohen Arazi [Sun, 5 Jun 2022 23:24:03 +0000 (20:24 -0300)]
Bug 30756: (follow-up) Restore MARC21 authority file

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30840: Add support for barcode filters to course reserves
Nick Clemens [Tue, 24 May 2022 18:27:30 +0000 (18:27 +0000)]
Bug 30840: Add support for barcode filters to course reserves

This bug adds support for barcode filters on the inputs in the course reserves module.

To test:
1 - Set itemBarcodeInputFilter to 'Remove spaces from'
2 - Find a barcode in your system and add spaces between each characters
    e.g. 3 9 9 9 9 0 0 0 0 0 0 8 1 8
3 - Past that barcode into the checkin box, success
4 - Browse to course reserves, ensure you have a course or create on
5 - Test adding a reserve, batch adding a reserve, and batch removing reserves
6 - The pasted barcode does not in any
7 - Apply patch and restart
8 - Pasted barcode with spaces can now successfuly be added, batch added, and batch removed from courses

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29961: Make horizontal scroll bar always visible on acqui/z3950_search.pl
Lucas Gass [Thu, 27 Jan 2022 16:55:34 +0000 (16:55 +0000)]
Bug 29961: Make horizontal scroll bar always visible on acqui/z3950_search.pl

To test:
1. In Acquisitions make a basket and add something "From an external source"
2. Search for a title and click on the 'MARC' button, make sure the MARC prview is both tall and wide.
3. You will not see the horizontal scroll bar unless you scroll all the way to the bottom of the preview.
4. Apply patch.
5. Try steps 1 & 2 again, this time you should see the horizontal scroll bar as soon as the MARC prveiw loads.

Note: I put the CSS on multiple lines for better readability

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30756: Rename to Koha_MetadataRecord_Authority
Marcel de Rooy [Sat, 14 May 2022 12:29:25 +0000 (12:29 +0000)]
Bug 30756: Rename to Koha_MetadataRecord_Authority

What we are actually testing here.

No test plan.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
JD amended patch: remove Dumper

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30756: Further adjustments to Koha_Authority.t
Marcel de Rooy [Sat, 14 May 2022 12:07:17 +0000 (12:07 +0000)]
Bug 30756: Further adjustments to Koha_Authority.t

Remove use of exported_records file in favor of TestBuilder.
Remove conditional tests with SKIP block. Create reservoir record.

Test plan:
Run t/db_dependent/Koha_Authority.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: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30756: Ground work for improving Koha_Authority.t
Marcel de Rooy [Sat, 14 May 2022 07:42:42 +0000 (07:42 +0000)]
Bug 30756: Ground work for improving Koha_Authority.t

Move stuff into two subtests.

Test plan:
Run t/db_dependent/Koha_Authority.t.
If you have no imported auths, you will still see skips.

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: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30855: (follow-up) Rewrite tests using Basic authentication
Tomas Cohen Arazi [Thu, 26 May 2022 14:35:41 +0000 (11:35 -0300)]
Bug 30855: (follow-up) Rewrite tests using Basic authentication

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30855: Rename /import => /import_batches
Tomas Cohen Arazi [Thu, 26 May 2022 14:17:18 +0000 (11:17 -0300)]
Bug 30855: Rename /import => /import_batches

This patch renames the route to make it consistent for future additions.

To test:
1. Run
   $ git grep 'matches/chosen'
=> FAIL: all occurences use /api/v1/import/
2. Apply this patch
3. Run:
   $ git grep 'matches/chosen'
=> SUCCESS: All occurences have '/api/v1/import_batches/'
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/import_record_matches.t
=> 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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 27697: Only preopulate search when we have found a single biblio
Nick Clemens [Wed, 18 May 2022 15:08:39 +0000 (15:08 +0000)]
Bug 27697: Only preopulate search when we have found a single biblio

This patch uses the url parameter we created in 23475 to determine whether
we should populate the search bar or not

Note - a bookmark with this param will still populate search term with last search

To test:
1 - Search staff client for 'cat'
2 - Browse to a patrons checkouts and click on a title, or just go directly to a details page:
    http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850
3 - Search bar says 'cat'
4 - Apply patch
5 - Repeat 1-2
6 - Search bar is not populated
7 - Search "dalek war box set" or a term that finds a single record in your instance
8 - Search bar is populated
9 - Note url like: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=2850&found1=1

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30781: Fix warning in GetPreparedLetter
Fridolin Somers [Thu, 19 May 2022 03:50:13 +0000 (17:50 -1000)]
Bug 30781: Fix warning in GetPreparedLetter

Test by running :
  prove t/db_dependent/Letters.t
Check you dont see warning :
  Use of uninitialized value $val in substitution iterator

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30781: Add unit test for substitute with undefined value
Fridolin Somers [Thu, 19 May 2022 03:47:18 +0000 (17:47 -1000)]
Bug 30781: Add unit test for substitute with undefined value

Add unit test that generates warn.
This may be usefull as no regression test.

Run prove t/db_dependent/Letters.t
You see warn :
t/db_dependent/Letters.t .. 1/84 Use of uninitialized value $val in substitution iterator at /kohadevbox/koha/C4/Letters.pm line 607.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30337: Holds to Pull ( pendingreserves.pl ) ignores holds if priority 1 hold...
Kyle Hall [Tue, 22 Mar 2022 18:14:52 +0000 (14:14 -0400)]
Bug 30337: Holds to Pull ( pendingreserves.pl ) ignores holds if priority 1 hold is suspended

Holds to Pull ( pendingreserves.pl ) ignores holds if priority 1 hold is suspended,
and shows the wrong number of "patrons with holds" which presumably tells the
librarian how many copies to pull from the shelves.

Test Plan:
1) Create a record with one or more holdable items
2) Place two holds on the record
3) Note they show in the holds to pull report
4) Suspend the priority 2 hold
5) Note the report continues showing that 2 patrons have holds
6) Resume the priority 2 hold
7) Suspend the priority 1 hold
8) Note the hold disappears from the holds to pull report
9) Apply this patch
10) Restart all the things!
11) Reload the holds to pull report
12) The report should show one hold that needs an item pulled to fill it!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30523: Quiet console warning about missing shortcut-buttons map file
Owen Leonard [Wed, 13 Apr 2022 12:18:13 +0000 (12:18 +0000)]
Bug 30523: Quiet console warning about missing shortcut-buttons map file

This patch updates the Flatpickr plugin shortcut-buttons which adds the
"Yesterday," "Today," and "Tomorrow" links to Flatpickr widgets.  This
updates it to the latest version, 0.4.0.

The file is modified in two ways: The version information is added to
the top of the file, and the sourceMappingURL line is removed from the
bottom. This quiets browser console warnings about a missing map file.

To test:
- apply the patch and clear your browser cache.
- Go to Circulation -> Check out and check out to a patron.
- Click "Checkout settings" and click the "Specify due date" field.
- In the pop-up calendar, test all controls, including the shortcut
  links, to confirm that everything works as before.
- In the browser console there should be no warning related to
  shortcut-buttons-flatpickr. (Firefox didn't have the warning, Chromium
  can be used.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28723: Replace "No title" by an empty string
Julian Maurice [Tue, 31 May 2022 09:36:37 +0000 (11:36 +0200)]
Bug 28723: Replace "No title" by an empty string

This is to be consistent with what is done in checkouts.js

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28723: Fix holds table display when a biblio has no title
Julian Maurice [Tue, 20 Jul 2021 12:45:35 +0000 (14:45 +0200)]
Bug 28723: Fix holds table display when a biblio has no title

Test plan:
1. Create a biblio without title, then create an item for this biblio.
2. Place a hold on it.
3. Go to the patron detail page and click on the Holds tab
4. Confirm that holds are correctly displayed

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30629: fix <span> in title of some pages
Victor Grousset/tuxayo [Fri, 13 May 2022 19:25:53 +0000 (21:25 +0200)]
Bug 30629: fix <span> in title of some pages

== Test plan ==
1. Go to http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=layout
2. See that the page title in your browser window title is wrong because it contains <span>
3. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=batch
4. See that the page title in your browser window title is wrong because it contains <span>
5. Go to http://localhost:8081/cgi-bin/koha/admin/aqbudgetperiods.pl
6. Administration => Budgets => Click on a budget => planning => plan by months
7. See that the page title in your browser window title is wrong because it contains <span>
8. Refresh the pages and see that the titles are correct
9. Sign off :)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28529: Make biblio-level hold itemtype count against max rules
Tomas Cohen Arazi [Wed, 1 Sep 2021 21:00:59 +0000 (18:00 -0300)]
Bug 28529: Make biblio-level hold itemtype count against max rules

The current situation is that biblio-level holds can be assigned an item
type, so they can only be fulfilled by items matching that specified
item type (be it item-level itype or the fallback to biblio-level).

But there's the situation in which max holds limits for a specific item
type can be overridden by using biblio-level holds with item type
selection (AllowHoldItemTypeSelection) enabled.

To test:
1. Have a patron of category 'Staff' (S)
2. Have 3 records with items with the 'BK' item type, and maybe others
3. Enable AllowHoldItemTypeSelection
4. Set a limit of 2 max holds for that category+item type
5. In the OPAC. Place bibio-level holds, with item type contraint to 'BK' on those 3 records
=> FAIL: You can place the 3 holds
6. Cancel the holds
7. Apply this patch and restart all
8. Repeat 5
=> SUCCESS: You can only place 2 holds
9. Run:
   $ kshell t/db_dependent/Reserves.t
=> SUCCESS: Tests pass!
10. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28529: Regression tests
Tomas Cohen Arazi [Fri, 3 Sep 2021 19:47:14 +0000 (16:47 -0300)]
Bug 28529: Regression tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30731: Remove Readonly::XS::MAGIC_COOKIE
Marcel de Rooy [Thu, 12 May 2022 07:05:50 +0000 (07:05 +0000)]
Bug 30731: Remove Readonly::XS::MAGIC_COOKIE

This variable does not make sense anymore, since the Readonly::XS
module is not listed in the cpanfile. So it will not be required
the versions_info loop.

Test plan:
Run t/Installer_PerlModules.t again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30731: Silence noisy CPAN modules in C4::Installer::PerlModules
Marcel de Rooy [Wed, 11 May 2022 14:26:06 +0000 (14:26 +0000)]
Bug 30731: Silence noisy CPAN modules in C4::Installer::PerlModules

Main change is replacing 'no warnings' by local $SIG{__WARN__}.

The modules are sorted now too. This will make results of requiring
them one after the other a more predictable experience and improves
the output of koha_perl_deps.

Test plan:
Run about. Check plack intranet log.
Run koha_perl_deps.pl -a

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30731: Unit tests
Marcel de Rooy [Wed, 11 May 2022 14:35:18 +0000 (14:35 +0000)]
Bug 30731: Unit tests

Installer_pm.t can safely be discarded, having Installer_PerlModules.t.

Note: Without the second patch, the test about versions_info being silent
might fail. With the second patch, it should pass.
Note that since the order of requiring the cpan modules varies (without
the second patch), the results (potential warnings) vary too.

Test plan:
Run t/Installer_PerlModules.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30842: 2FA - Allow at least one old TOTP
Jonathan Druart [Wed, 25 May 2022 08:04:58 +0000 (10:04 +0200)]
Bug 30842: 2FA - Allow at least one old TOTP

We allow one old token when we are setting the two-factor auth, we
should reuse the same settings when validation the authentication
itself.

Test plan:
Setup 2FA for your logged-in user
Logout/Login
Have a look at the code and wait for 30 sec before using it (< 1min
however)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30786: Fix capitalization in advanced search system preferences
David Nind [Wed, 18 May 2022 02:21:14 +0000 (02:21 +0000)]
Bug 30786: Fix capitalization in advanced search system preferences

This fixes the capitalization in the descriptions for the
AdvancedSearchTypes and OpacAdvancedSearchTypes system preferences.

Test plan:
1. In the staff interface, search the system preferences for
   'AdvancedSearch'.
2. Review the current descriptions for the AdvancedSearchTypes and
   OpacAdvancedSearchTypes system preferences.
3. Note that "..Shelving Location.." is used instead of "..Shelving
   location..".
4. Apply the patch.
5. Refresh the page.
6. Sentence case is now used for "Shelving location" in the
   descriptions (as per coding guideline HTML4: Upper and lower cases
   in strings).
7. Sign off.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30788: Unit test
Katrin Fischer [Fri, 20 May 2022 08:05:43 +0000 (08:05 +0000)]
Bug 30788: Unit test

Run:
  prove t/db_dependent/Circulation/CalcFine.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30788: Fix warning in Overdues.pm when fine is empty in circ rules
Katrin Fischer [Fri, 20 May 2022 07:43:15 +0000 (09:43 +0200)]
Bug 30788: Fix warning in Overdues.pm when fine is empty in circ rules

Argument "" isn't numeric in multiplication (*) at /usr/share/koha/lib/C4/Overdues.pm

To test:
* Create a issuing rule where fine is empty, but a fine interval is set.
  Fine amount: empty
  To do this, remove the 0 displayed in the input field before saving.
  Fine charging interval: 5 or any other numeric value
  When to charge: Start of interval
  Fine grace period: 0
* Check out an item with the due date yester (use specify due date)
* Run misc/cronjobs/fines.pl -v
* You should see above warn in the output
* Apply patch
* Rerun fines.pl, there should be no warn.
* Run:
  t/db_dependent/Circulation/CalcFine.t
  t/db_dependent/Fines.t
  t/db_dependent/Circulation.t
  t/db_dependent/Overdues.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30828: Remove useless 'type' parameter in placerequest.pl
Joonas Kylmälä [Sat, 21 May 2022 19:23:32 +0000 (19:23 +0000)]
Bug 30828: Remove useless 'type' parameter in placerequest.pl

To test:
 1) Grep for placerequest.pl in the source code and check that
    request.tt is the only place where the type parameter is passed.

Signed-off-by: David Nind <david@davidnind.com>
JD amended patch: adjust commit title
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30774: Typo: i %sEdit %sReserve %s
Owen Leonard [Tue, 17 May 2022 11:19:19 +0000 (11:19 +0000)]
Bug 30774: Typo: i %sEdit %sReserve %s

This patch removes an out of place "i" and replaces it with a space. The
patch also removes obsolete CDATA markers in the page's JavaScript.

To test, apply the patch and go to Course reserves.

- Create a course if necessary, then view the details of your course.
- Click the "Add reserves" button.
- Enter a barcode or biblionumber.
- On the next page, the heading "Reserve [title] for [course]" should
  look correct, with no extra "i" at the beginning of the line.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30772: (follow-up) Age restriction message
David Nind [Sat, 28 May 2022 18:55:59 +0000 (18:55 +0000)]
Bug 30772: (follow-up) Age restriction message

Improve age restriction message.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30772: Terminology: Replace instances of "reserve" with "hold"
Owen Leonard [Tue, 17 May 2022 12:04:41 +0000 (12:04 +0000)]
Bug 30772: Terminology: Replace instances of "reserve" with "hold"

There were several templates where we were still using the term
"reserve" instead of "hold." This patch corrects the ones I found,
including in a couple of HTML comments.

To test, apply the patch and confirm that the changes look correct and
affect only the relevant term.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29860: Remove item type-related warnings
Tomas Cohen Arazi [Wed, 12 Jan 2022 14:15:10 +0000 (11:15 -0300)]
Bug 29860: Remove item type-related warnings

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/selenium/regressions.t
=> FAIL: You see several
item-level_itypes set but no itemtype set for item (985) at /kohadevbox/koha/Koha/Schema/Result/Item.pm line 905.
2. Apply this patch
3. Repeat 1
=> SUCCESS: No more item type warnings
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30761: Fix typos in OPAC reset password template
Owen Leonard [Tue, 17 May 2022 12:30:28 +0000 (12:30 +0000)]
Bug 30761: Fix typos in OPAC reset password template

This patch corrects the word "PLease" to "Please." The patch also adds
some periods at the end of some alert strings to make punctuation
consistent between different alerts.

To test, an inspection of the patch is probably enough. The main fix
(the "PLease") only appears when an unknown error occurs.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30862: Typo: langues
Caroline Cyr La Rose [Fri, 27 May 2022 21:52:06 +0000 (17:52 -0400)]
Bug 30862: Typo: langues

This patch changes the word 'langues' to 'languages' in the description
of the following system preferences:

- OPACXSLTDetailsDisplay

- OPACXSLTListsDisplay

- OPACXSLTResultsDisplay

- XSLTDetailsDisplay

- XSLTListsDisplay

- XSLTResultsDisplay

To test:
1- Apply patch
2- Check the aforementioned system preferences and make sure the descriptions say 'languages'

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30853: Add description for baskets in swagger.yaml
Tomas Cohen Arazi [Thu, 26 May 2022 12:52:46 +0000 (09:52 -0300)]
Bug 30853: Add description for baskets in swagger.yaml

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30528: Process limits before handling CCL query
Nick Clemens [Thu, 14 Apr 2022 12:20:09 +0000 (12:20 +0000)]
Bug 30528: Process limits before handling CCL query

This patch moves the code that handles limit processing before that for CCL queries to ensure that special limit cases (branch, multibranch, etc) are handled before adding the limits to the query string

To test:
1 - Apply unit tests patch only
2 - prove -v t/db_dependent/Search.t
3 - It fails
4 - Apply this patch
5 - It passes!
6 - Test searching and confirm things work as epxected

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30528: Unit tests
Nick Clemens [Thu, 14 Apr 2022 12:19:22 +0000 (12:19 +0000)]
Bug 30528: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30870: Don't skip tests if Test::Deep if not installed
Jonathan Druart [Tue, 31 May 2022 09:29:57 +0000 (11:29 +0200)]
Bug 30870: Don't skip tests if Test::Deep if not installed

We are using Test::Deep in different tests, but from t/db_dependent/Koha.t the tests are skippted if the module is not installed.
We must assume the module is installed

Test plan:
  prove t/db_dependent/Koha.t
should return green in ktd

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29883: Add test
Jonathan Druart [Tue, 31 May 2022 09:26:36 +0000 (11:26 +0200)]
Bug 29883: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29883: avoid uninitialized value warn in GetAuthorisedValues sub
Petro Vashchuk [Fri, 14 Jan 2022 09:57:39 +0000 (11:57 +0200)]
Bug 29883: avoid uninitialized value warn in GetAuthorisedValues sub

GetAuthorisedValues is defined with optional parameter $category but it
is instantly interpolated without preventing "Use of uninitialized value
$category in concatenation (.) or string at .../C4/Koha.pm line 491."
warning.
As category param is optional, we can avoid throwing that warn as it is
something that can happen and is not an actual error:
C<$category> returns authorized values for just one category (optional).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30854: (QA follow-up) Spec fixes
Tomas Cohen Arazi [Thu, 26 May 2022 13:42:29 +0000 (10:42 -0300)]
Bug 30854: (QA follow-up) Spec fixes

This patch fixes minor spec QA issues:

* Missing summary for routes
* Missing error_code description for 500

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30854: Missing description for 'import_record_matches' in swagger.yaml
Tomas Cohen Arazi [Thu, 26 May 2022 13:38:59 +0000 (10:38 -0300)]
Bug 30854: Missing description for 'import_record_matches' in swagger.yaml

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30742: Remove 'bad_bibs' and send a list of holdable bibs
Nick Clemens [Fri, 13 May 2022 15:23:30 +0000 (15:23 +0000)]
Bug 30742: Remove 'bad_bibs' and send a list of holdable bibs

Currently place request gets a list of bad_bibs that is created via javascript on the
template. It ignores this list

Ths patch instead doesn't add info for bad bibs, and provides a list of the bibs that
can be held

To test:
1 - Attempt multi hold with some items that can be held, and one that cannot due to notforloan
2 - Fill in pickup locations and place hold
3 - Note hold is place on bib with no avilable items and hsows twice in results
4 - Apply patch
5 - repeat with another patron
6 - Note no aidditonal hold on record with notforloan items
7 - Note with with not for loan items appears only once in results

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30742: Prevent placing holds on items/records where all items notforloan
Nick Clemens [Fri, 13 May 2022 14:01:48 +0000 (14:01 +0000)]
Bug 30742: Prevent placing holds on items/records where all items notforloan

This patch does a few things:
1 - Adds itemtype not for loan status to display
2 - Adds a conditional to display notforlaon status as the reason a hold cannot be placed
3 - Seperates the lower 'Place hold(s)' buttons for single and multi holds into two template sections
4 - Handles the case where all bibs in a multi hold have no items available
5 - Disables the button for single hlds when all items are unavailable

To test:
 1 - Find or create a record with all items of itemtype marked 'notforloan'
 2 - Attempt to place single hold on this record from staff client
 3 - See one disab;ed button, one enabled 'Place holds' button
 4 - Click 'Place holds' - hold placed
 5 - Cancel hold
 6 - Place multiple holds with some bibs that can be held, and this one that cannot
 7 - Notice message that 'Cannot place hold on some items'
 8 - Click 'Place holds' - hold is generated for the notforloan bib
 9 - Apply patch
10 - Place single hold
11 - Note you now see not for loan status on items
12 - Note the red x also includes message abnout not for loan status
13 - Note the 'Place hold' button is disabled
14 - Attempt multi hold
15 - Message now includes "No items available: One or more records have no items that can be held"
16 - Click 'Place holds'
17 - Above still places the hold - this is for a followup patch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30837 - Fix table width on 'Print summary'
Magnus Enger [Tue, 24 May 2022 12:12:35 +0000 (12:12 +0000)]
Bug 30837 - Fix table width on 'Print summary'

To reproduce:
- Make sure you have a patron with at least one checkout,
  one hold and one fine
- On the detail page for that patron, go to Print > Print
  summary
- Observe the tables are too wide to fit on a printed page

To test:
- Apply this patch
- Repeat the steps above
- Observe the table now fits on the page

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30831: Unit test
Nick Clemens [Mon, 23 May 2022 12:18:11 +0000 (12:18 +0000)]
Bug 30831: Unit test

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: minor typo fix

2 years agoBug 30830: Add Koha Objects for Koha Import Items
Nick Clemens [Mon, 23 May 2022 12:25:53 +0000 (12:25 +0000)]
Bug 30830: Add Koha Objects for Koha Import Items

To test:
prove -v t/db_dependent/Koha/Import/Record/Items.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28152: Log the "duplicate item barcode" error
Jonathan Druart [Mon, 10 Jan 2022 10:22:54 +0000 (11:22 +0100)]
Bug 28152: Log the "duplicate item barcode" error

Looking at the code this 'import_error' column is empty for the last 9 years. Not sure it makes much sense to have this single error now.

commit 1dba9c6409d78cb1f90de6c1300cb5b63fb1b851
Date:   Wed Oct 10 14:21:22 2012 -0500
    Bug 7131: teach MARC import how to overlay items

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 28152: Fix import_items row creation if duplicate barcode
Jonathan Druart [Thu, 15 Apr 2021 10:12:23 +0000 (12:12 +0200)]
Bug 28152: Fix import_items row creation if duplicate barcode

We are trying to insert "duplicate item barcode" into import_items.itemnumber (integer),
it fails with "Incorrect integer value: 'duplicate item barcode' for column 'itemnumber' at row 1"

To reproduce:
Export a biblio with an item
Import it
=> The item is not added, and there is no new row in import_items.

The error only appears in the log if you comment the close STDERR and
close STDOUT lines

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 29828: Prevent additional content to be created without default
Jonathan Druart [Mon, 10 Jan 2022 09:15:35 +0000 (10:15 +0100)]
Bug 29828: Prevent additional content to be created without default

When creating or editing an additional content, the form is submitted if
only the title of the 'default' tab is filled in.
We should submit the form only if both title and content exist.

Test plan:
Create a new content using text editor (codemirror)
Confirm that the form is submitted only if title and content from the
default tab are not empty
Try again with wysiwyg (tinymce)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoKoha 22.06 - start of a new dev cycle
Tomas Cohen Arazi [Tue, 31 May 2022 11:42:29 +0000 (08:42 -0300)]
Koha 22.06 - start of a new dev cycle

    The road of excess
    leads to the palace of wisdom;
    for we never know what is enough
    until we know what is more than enough.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoKoha 22.05.00 is here! v22.05.00
Fridolin Somers [Thu, 26 May 2022 09:47:49 +0000 (23:47 -1000)]
Koha 22.05.00 is here!

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years ago22.05.00: Fix translations (bis)
Fridolin Somers [Thu, 26 May 2022 09:42:40 +0000 (23:42 -1000)]
22.05.00: Fix translations (bis)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years ago22.05.00: Fix translations
Jonathan Druart [Fri, 26 Nov 2021 10:01:09 +0000 (11:01 +0100)]
22.05.00: Fix translations

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoTranslation updates for Koha 22.05.00
Koha translators [Thu, 26 May 2022 08:11:24 +0000 (05:11 -0300)]
Translation updates for Koha 22.05.00

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoAdd release notes for Koha 22.05.00
Fridolin Somers [Thu, 26 May 2022 07:37:13 +0000 (21:37 -1000)]
Add release notes for Koha 22.05.00

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30808: Add the 22.05 release team.
Martin Renvoize [Thu, 19 May 2022 12:40:56 +0000 (13:40 +0100)]
Bug 30808: Add the 22.05 release team.

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

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years ago22.05.00: Update kohastructure.sql
Fridolin Somers [Thu, 26 May 2022 03:00:48 +0000 (17:00 -1000)]
22.05.00: Update kohastructure.sql

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years ago22.05.00: Update mailmap
Fridolin Somers [Thu, 26 May 2022 02:13:29 +0000 (16:13 -1000)]
22.05.00: Update mailmap

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years ago22.05.00: Update history.txt
Fridolin Somers [Thu, 26 May 2022 02:03:32 +0000 (16:03 -1000)]
22.05.00: Update history.txt

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years ago22.05.00: Update contributors.yaml
Fridolin Somers [Thu, 26 May 2022 02:01:56 +0000 (16:01 -1000)]
22.05.00: Update contributors.yaml

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoAdd Jeremy Breuillard to mailmap
Fridolin Somers [Thu, 26 May 2022 01:53:46 +0000 (15:53 -1000)]
Add Jeremy Breuillard to mailmap

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoAdd Thibaud Guillot to mailmap
Fridolin Somers [Thu, 26 May 2022 01:48:09 +0000 (15:48 -1000)]
Add Thibaud Guillot to mailmap

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30852: DBRev 21.12.00.057
Fridolin Somers [Thu, 26 May 2022 06:35:04 +0000 (20:35 -1000)]
Bug 30852: DBRev 21.12.00.057

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30852: Add index on article_requests.debit_id
Fridolin Somers [Thu, 26 May 2022 06:32:35 +0000 (20:32 -1000)]
Bug 30852: Add index on article_requests.debit_id

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30747: (follup-up) Add missing otherholdings_datelastborrowed column in settings
Fridolin Somers [Mon, 23 May 2022 18:40:51 +0000 (08:40 -1000)]
Bug 30747: (follup-up) Add missing otherholdings_datelastborrowed column in settings

See Bug 24176

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30747: Make column settings work for otherholdings table using forEach loop
Lucas Gass [Wed, 18 May 2022 14:12:11 +0000 (14:12 +0000)]
Bug 30747: Make column settings work for otherholdings table using forEach loop

To test:

1. Turn on SeparateHoldings and find a record that has some items at
   different home libraries.
2. Look at the Other holdings(x) tab. Notice there is no Columns tool
   (gear icon).
3. Go to Table Settings, try hiding columns from the otherholdings
   table. You cannot.
4. Apply patch.
5. Now under the Other holdings(x) tab you should see the Columns
   button, it should work.
6. Go back to Table settings and try hiding columns, it should work.
7. Now try uploading an item level cover image, make sure all columns
   are still properly hidden and the Columns tool works
8. Try steps 6 & 7 but with the regular holdings table. Confirm that all
   colums can properly hide.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Included a rename to table_name(s).
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30730: (follow-up) Simplify query
Martin Renvoize [Thu, 19 May 2022 14:52:21 +0000 (15:52 +0100)]
Bug 30730: (follow-up) Simplify query

This patch drops the 'fetch all non-loanable items' query used in the
subsequent query as part of the 'not_in' and instead replaces it with a
simple filter on 'notforloan => 0'

Test plan
Run the included unit tests before and apply applying the followup.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30730: Unit tests
Shi Yao Wang [Tue, 17 May 2022 15:37:21 +0000 (11:37 -0400)]
Bug 30730: Unit tests

Added an entry in holds for an item with negative notforloan value to
test if get_items_that_can_fill returns the right items.

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 30730: Holds to Pull should not list items with a notforloan status
Shi Yao Wang [Tue, 17 May 2022 15:08:06 +0000 (11:08 -0400)]
Bug 30730: Holds to Pull should not list items with a notforloan status

Remove items with a notforloan value other than 0 because items that are
potentially holdable (with negative notforloan status) are not wanted in holds to pull.

Test plan:
1- Have a bib with 2 items, both holdable. Give one of these items a notforloan status with a negative value (like Ordered in the testing docker data).
2- Place a title-level hold on your bib
3- Confirm your bib is showing on Holds to Pull as expected, prompting staff to pull the item that does not have a not for loan status (correct!)
4- Take the item that does not have a not for loan status and check it out to a different patron, make sure not to fill or cancel your hold
5- Reload Holds to Pull, see your title is still listed and now Koha is directing staff to the item with a notforloan status
6- Apply the patch
7- Reload Holds to Pull, see your title with a notforloan status is gone
8- Run `prove t/db_dependent/Koha/Holds.t` and all tests should pass

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 30735: Fix filtering by patron attribute with AV in overdues report
Fridolin Somers [Wed, 11 May 2022 20:51:20 +0000 (10:51 -1000)]
Bug 30735: Fix filtering by patron attribute with AV in overdues report

In Circulation > Overdues, if there are seachable patron attributes
they can be used in left filters. Search does not work if this attribute
is linked to an authorized values category.

The problem is that AV code is compared to the AV desciption in :
  if (grep { $attrval eq lc($_->[1]) } @{ $pattrs->{$code} }) {

Looking at a Data::Dumper of the var $pattrs you see for example :
$VAR1 = {
          'ATT1' => [
                      [
                        'afr',
                        'Afrikaans'
                      ]
                    ]
        };
First row is attribute code and second row is desciption.
It works for an attribute without AV because in this case
'avdescription' is undefined so code is stored as description :
          push @{ $pattrs->{$row->{attrcode}} }, [
            $row->{attrval},
            defined $row->{avdescription} ? $row->{avdescription} : $row->{attrval},
        ];

This patch fixes the code and removes commented line.
Also reviews the SQL query :
  - avcategory is useless
  - use alias attrcode for borrower_attributes.code to be more explicit

Test plan :
1) Create a patron A with overdues
2) Go to Circulation > Overdues
3) Check you see the patron A
4) Create a patron attribute, searchable, with an authorized value
   category, ie LANG
5) Edit patron A to set a value in this attribute
6) Go to Circulation > Overdues
7) Select attribute value and apply filter
8) Check you see the patron A
9) Redo test plan with a patron attribute, searchable, without an
   authorized value category

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 30797: (follow-up) Hide default Flatpickr clear-field button
Owen Leonard [Wed, 18 May 2022 12:27:02 +0000 (12:27 +0000)]
Bug 30797: (follow-up) Hide default Flatpickr clear-field button

The basic MARC editor has its own button associated with each subfield
for emptying the contents of the input. Since the Flatpickr "X" icon
causes a layout problem and would be redundant, we can hide it on this page.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30797: Add the calendar.inc include to addbiblio.tt
Alex Buckley [Wed, 18 May 2022 04:07:06 +0000 (04:07 +0000)]
Bug 30797: Add the calendar.inc include to addbiblio.tt

addbiblio.tt throws the '$(...).flatpickr is not a function' because it
is missing includes to flatpickr.min.js and shortcut-buttons-flatpickr.min.js

To fix this the addbiblio.tt should include the calendar.inc file (like
additem.tt does) which includes to those aforementioned JS files.

Test plan:
1. Edit a MARC bibliographic framework
2. Make the 902$d subfield visible in the Editor
3. Also set the 902$d subfield plugin='dateaccessioned.pl'
4. Catalogue a new biblio record
5. Notice the 902$d subfield has not been pre-populated with todays date
6. Right click, choose 'Inspect', observe this JS error in the console: "Uncaught
TypeError: $(...).flatpickr is not a function"
7. Apply patch, and restart services
8. Repeat steps 4-6 and this time observe the 902$d is pre-populated,
and there is no flatpickr JS error in the console

Sponsored-by: Chartered Accountants Australia and New Zealand
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30009: Do not set MARCNOTES to empty list in list context
Nick Clemens [Fri, 18 Mar 2022 15:03:30 +0000 (15:03 +0000)]
Bug 30009: Do not set MARCNOTES to empty list in list context

AMENDED:
We should not pass an empty list here, but just undef in order to
prevent creating a shift of elements in the hash.

To test:
1 - Find or create an invalid marc record
2 - View in staff client
3 - Note tab Descriptions(1) has no content
4 - Apply patch, reload
5 - No empty tab

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30714: Do no log update to holdingbranch
Nick Clemens [Fri, 6 May 2022 20:32:32 +0000 (20:32 +0000)]
Bug 30714: Do no log update to holdingbranch

When an item from another branch is checked in, the holdingbranch is
updated, and this change is logged.  We record the checkin in
statistics, we do not need the cataloguing update logged

To recreate:
1 - Enable cataloguing log
2 - Check in an item with a different holding branch
3 - Check the action logs
4 - There is a cataloguing log for the holdingbranch update
5 - Apply patch
6 - Repeate with another item
7 - No log added!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30714: Unit test
Nick Clemens [Fri, 6 May 2022 20:32:12 +0000 (20:32 +0000)]
Bug 30714: Unit test

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30776: import missing subroutine to fix import_webservice_batch.pl
Joonas Kylmälä [Mon, 16 May 2022 18:56:05 +0000 (18:56 +0000)]
Bug 30776: import missing subroutine to fix import_webservice_batch.pl

Test plan:
 1) Apply patch and notice the following error is gone:
    $ perl misc/cronjobs/import_webservice_batch.pl
    Undefined subroutine &main::GetStagedWebserviceBatches called at misc/cronjobs/import_webservice_batch.pl line 46.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30640: Focus does not always move to correct search header form field
Owen Leonard [Thu, 28 Apr 2022 11:37:31 +0000 (11:37 +0000)]
Bug 30640: Focus does not always move to correct search header form field

This patch updates the staff interface's global JavaScript to
accommodate changes in the way focus is being handled after the jQuery
upgrade (see: https://github.com/jquery/jquery/issues/4950).

The "focus" class is removed from search header include files so that
there isn't a contradiction between which form field has the focus class
and which form field is displayed in the active tab.

To test, apply the patch and view various pages in the staff interface.

- On pages where focus is not being directed to a form field within the
  main content of the page, the form field in the active search header
  tab should have focus on page load:

  - Patron details
  - System preferences
  - Cities and towns

  Also test pages where a tab other than the first one is preselected:

  - Bibliographic details page
  - Patron lists

  On these pages, focus should move to the active tab's form field when
  you switch tabs.

- On pages where focus is being sent to another form field, it should
  work correctly:

  - Patrons home page
  - Check in
  - Acquisitions home page

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30695: (follow-up) Fix selenium test
Martin Renvoize [Tue, 17 May 2022 07:22:37 +0000 (08:22 +0100)]
Bug 30695: (follow-up) Fix selenium test

The tab title words were re-ordered and we forgot to update the
corresponding selenium test.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2 years agoBug 30720: Batch action links in result list missing permission checks
Katrin Fischer [Fri, 13 May 2022 10:25:27 +0000 (10:25 +0000)]
Bug 30720: Batch action links in result list missing permission checks

In the staff interface you can select records for merging, batch editing,
and batch deleting from the result list. This fixes the code to check for
the specific batch edit records and batch delete records permissions, so
those actions are only shown if the user has the right permissions.
As there is no merge record permission yet, it's assumed that edit_cataloge is
needed as before (no change in behavior).

To test:
- Create a staff user with only catalogue and editcatalogue permissions.
- Do a search in the catalog of the staff interface
- Select a few records from result list to unlock the Edit button on top
- Verify it shows all three options: edit, delete and merge
- Apply patch
- Verfiy now only merging is shown
- Add the records_batchdel and records_batchmod permissions from the tools
  area one after another and verify the display changes accordingly.

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 30701: Make Upload Tool buttons work on mobile-size screen
Aleisha Amohia [Fri, 6 May 2022 03:33:59 +0000 (03:33 +0000)]
Bug 30701: Make Upload Tool buttons work on mobile-size screen

When the Upload tool is accessed on a smaller (mobile) screen (less than
768 pixels wide), the Upload and Browse buttons cannot be clicked. This
patch fixes that.

To test:
1) Go to Tools -> Upload
2) Make the screen narrower, either by opening your browser's Inspector
tool and using Responsive Design Mode, or by dragging in the edge of the
window to make it narrower.
3) Notice that when the screen becomes narrower than 768px, the sections
squash together and the padding between them is lost. Try to click on
the Browse and Upload buttons, notice you cannot.
4) Apply patch and refresh the Upload Tool
5) Ensure the screen is narrower than 768px. Confirm there is now
padding between the sections, and the buttons are clickable again.

Sponsored-by: Chartered Accountants Australia and New Zealand
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30740: Link to authorities 'used in' should not use equal
Fridolin Somers [Thu, 12 May 2022 07:23:58 +0000 (21:23 -1000)]
Bug 30740: Link to authorities 'used in' should not use equal

When showing an authority, there is a link to search biblio records it is used in.
Actually this link uses 'q=an=$auth_id', this is wrong for an URL, and other places use 'idx:value'.
It does not break search with Zebra nor Elasticsearch but it is better to use ':'

Test plan :
Check changed links return same results with and without patch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29719: Do not clear onloan value when not passed in MARC
Nick Clemens [Fri, 14 Jan 2022 19:59:30 +0000 (19:59 +0000)]
Bug 29719: Do not clear onloan value when not passed in MARC

We blank the field to prevent users from setting it during import, but this has the
affect of blanking it in the DB.
This patch replaces the onloan field when not passed in to 'ModItemFromMARC' to preserve
the value

To test:
 1 - Check an item out to a paron
 2 - Export the item using Tools->Export data
 3 - Stage the record for import
 4 - Match on 999c and replace items
 5 - Import the batch
 6 - View the record and note item is checked out and Available
 7 - In the DB note the onloan value is now null
 8 - Check in the item
 9 - Apply patch
10 - Repeat 1-5
11 - View the record and note item is checked out
12 - In the DB note the onloan value matches the due date

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 29719: Unit tests
Nick Clemens [Fri, 14 Jan 2022 19:59:07 +0000 (19:59 +0000)]
Bug 29719: Unit tests

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 30207: Allow any reserveforothers subpermission to access the page
Kyle Hall [Tue, 10 May 2022 10:56:15 +0000 (06:56 -0400)]
Bug 30207: Allow any reserveforothers subpermission to access the page

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30207: Librarians with only "place_holds" permission can no longer update hold...
Kyle Hall [Tue, 1 Mar 2022 16:49:49 +0000 (11:49 -0500)]
Bug 30207: Librarians with only "place_holds" permission can no longer update hold pickup locations

Bug 29540 increased the flags required to for modreserve.pl, but in doing so created a situation where a library can select a different pickup location for a hold, but upon clicking the "Update hold(s)" button, will be logged out due to having insufficient permissions for modreserve.pl.

Test Plan:
1) Create a librarian with "place_holds" permissions, but not "modify_holds_priority".
2) Place a hold for a patron
3) Attempt to change the pickup location from request.pl
4) Note you get logged out with a permissions error
5) Apply this patch
6) Restart all the things!
7) Attempt to change the pickup location from request.pl
8) This time it should succeed!

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30666: Holds reminder cronjob (holds_reminder.pl) uses DataTime::subtract wrong
Kyle M Hall [Tue, 3 May 2022 10:29:49 +0000 (06:29 -0400)]
Bug 30666: Holds reminder cronjob (holds_reminder.pl) uses DataTime::subtract wrong

In holds_reminder.pl, the script loops over all available branchcodes. For each iteration of the loop, if not using the calendar, the script subtracts the days parameter from the current date to get the waiting date threshold. The problem is that this method alters the DateTime object in $date_to_run, so for each iteration of the loop, the waiting date becomes farther and farther in the past, when it should always be the same!

The solution is to either clone the "date to run" for each call to subtract, or to move it out of the loop since it doesn't need to be recalculated each time.

Test Plan:
1) Become the koha user using koha-shell
2) Run DBIC_TRACE=1 misc/cronjobs/holds/holds_reminder.pl --days 7
3) Note in the queries that for each loop, the waiting date is different
4) Apply this patch
5) Run the command in step 2 again
6) Note the queries all now have the same waiting date threshold!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30667: Holds reminder cronjob (holds_reminder.pl) never uses default letter template
Kyle Hall [Tue, 3 May 2022 10:53:43 +0000 (06:53 -0400)]
Bug 30667: Holds reminder cronjob (holds_reminder.pl) never uses default letter template

Bug 28514 changed the way holds_reminder.pl searches for templates, using a direct search for letters,
but should be using find_effective_template instead. Now, if a branch specific template does not exist,
it will skip that branch.

Test Plan:
1) Ensure you only have the default HOLD_REMINDER template
2) Become the koha user using koha-shell
3) Run misc/cronjobs/holds/holds_reminder.pl --days 7 -v
4) Note that the script skips every branch
5) Apply this patch
6) Run the command in step 3 again
7) Note the script doesn't skip over any branches

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30422: Authorities editor update broke the feature added by Bug 20154
Owen Leonard [Thu, 31 Mar 2022 15:51:14 +0000 (15:51 +0000)]
Bug 30422: Authorities editor update broke the feature added by Bug 20154

This patch corrects JavaScript in authorities templates so that
clicking "Edit" on the authority detail page will take you to the
authority edit page while keeping the same tab open.

This patch also corrects the JavaScript which should have been
automatically moving the cursor focus to the first form field when
switching tabs in the editor.

This patch also adds the "Section" headings which are present in the
basic cataloging editor but were not added here at the time of the
page's tabs revision.

To test, apply the patch and locate an authority record in your catalog.

- Without changing tabs, choose "Edit record" from the "Edit" dropdown
  menu."
- The authorities editor should load and display the "Section 0" tab.
- Return to the authority detail page and select a tab besides tab 0.
- Click back to tab 0. Editing the record at this point should open the
  editor to Section 0.
- Return to the authority detail page.
- Click any of the numbered tabs besides tab 0.
- Choose "Edit record" from the "Edit" dropdown menu.
- When the authorities edit page loads the same tab should be
  preselected.
- Test that when you switch tabs in the authority editor the cursor
  focus is automatically moved to the first visible input.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30139: Same fix for the other javascript moneyFormat function
Shi Yao Wang [Fri, 13 May 2022 14:18:22 +0000 (10:18 -0400)]
Bug 30139: Same fix for the other javascript moneyFormat function

This patch makes javascript moneyFormat function in paycollect.tt consistent
with the one in pay.tt

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30139: Fix javascript moneyFormat to be compatible with FR format
Shi Yao Wang [Tue, 10 May 2022 17:34:15 +0000 (13:34 -0400)]
Bug 30139: Fix javascript moneyFormat to be compatible with FR format

New way of formatting money amount to make it work with FR format

Test plan:
1- Set CurrencyFormat pref to FR
2- Activate Point of sale and cash register features
3- Add cash register
4- Add debit type that 'can be sold' with a price of 10.00
5- Go to point of sale, click on the item to purchase
6- Verify the Amount to be paid shows the wrong amount and can't be fixed on the interface
7- Apply the patch
8- Refresh the page and do step 5 again
9- Notice it now shows the right amount

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30717: (QA follow-up) Move to module
Marcel de Rooy [Fri, 13 May 2022 07:29:04 +0000 (07:29 +0000)]
Bug 30717: (QA follow-up) Move to module

We will probably use this a bit more :)
Let's put it in a module (with a trivial test).

Test plan:
Repeat item edit.
Run  t/DateUtils.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30717: Format dates when editing items
Jonathan Druart [Mon, 9 May 2022 08:28:51 +0000 (10:28 +0200)]
Bug 30717: Format dates when editing items

This is a result of bug 29369 and bug 27526.
Bug 29369 removed the format of the dates, and bug 27526 assumed that it
was the correct behaviour.

Here we don't want to let the controller know which fields is a date, or
we will have to access the subfield structure to know which subfields
have the "date cataloguing plugin".

This patch suggests to use the altFormat options from flatpickr that
will "Show the user a readable date (as per altFormat), but return
something totally different to the server."

It's actually an option we want to use for all our dates, that will
reduce a lot the overhead in our controllers.

Test plan:
Edit items (additem.pl and in batch) and confirm that the subfields
using the dateaccessioned plugin are displayed according to the
dateformat syspref. Make sure the date is stored correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30721: Markup error in detail page's component parts tab
Owen Leonard [Mon, 9 May 2022 15:22:16 +0000 (15:22 +0000)]
Bug 30721: Markup error in detail page's component parts tab

This patch adds a missing </div> to the bibliographic detail
page template in the section for showing component parts.
Some comments are added to clarify the markup structure.

To test you should have a record in your catalog with component
parts. Bug 11175 provides one you can import if necessary:
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=78023

To see the error, go to the staff interface, locate the record
in question and view the detail page. Under the Components tag,
scroll to the bottom. You will see content from "later" tabs at
the bottom, e.g. "There is no order for this bibliographic record"
or "No images have been uploaded for this bibliograhpic record yet."

Apply the patch and reload the page. The tabs should still look
correct, and now the tab content should be correctly isolated.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30728: (QA follow-up) Fix missing comma
Nick Clemens [Fri, 13 May 2022 11:48:00 +0000 (11:48 +0000)]
Bug 30728: (QA follow-up) Fix missing comma

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2 years agoBug 30520: Allow BatchImport to be used by command line tools.
Andreas Jonsson [Wed, 13 Apr 2022 07:20:42 +0000 (09:20 +0200)]
Bug 30520: Allow BatchImport to be used by command line tools.

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 30689: Incorrect Babeltheque setting can cause console warning
Owen Leonard [Thu, 5 May 2022 11:13:08 +0000 (11:13 +0000)]
Bug 30689: Incorrect Babeltheque setting can cause console warning

This patch adds an additional system preference check to the part of the
OPAC bibliographic detail template which conditionally loads Babelthèque
JavaScript. The script tag should not be output if there is no
Babeltheque_url_js setting to use.

To test, apply the patch and search for "Babeltheque" in system
preferences.

 - Set "Babeltheque" to "Do" include information.
 - Enter a path in the "Babeltheque_url_js" preference, e.g.
   "https://www.example.com/example.js" It doesn't have to be a valid
   Babeltheque URL.
 - In the OPAC, view the bibliographic detail page for any title. If you
   used a dummy URL for the js preference you should see an error in the
   console about the file not being found. This confirms that the
   template logic is working. If you used a working Babeltheque URL then
   the corresponding content should load.
 - Return to system preferences and remove the URL from the
   "Babeltheque_url_js" preference.
 - Return to the bibliographic detail page in the OPAC and confirm that
   there is no warning in the console about "'src' attribute of <script>
   element is empty."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30728: Fix typo 'in real time'
Fridolin Somers [Fri, 13 May 2022 08:07:56 +0000 (22:07 -1000)]
Bug 30728: Fix typo 'in real time'

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30728: BDRev 21.12.00.056
Fridolin Somers [Fri, 13 May 2022 07:58:25 +0000 (21:58 -1000)]
Bug 30728: BDRev 21.12.00.056

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30728: Make RealTimeHoldsQueue disabled by default
Tomas Cohen Arazi [Tue, 10 May 2022 17:26:30 +0000 (14:26 -0300)]
Bug 30728: Make RealTimeHoldsQueue disabled by default

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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30728: Only trigger real-time holds queue update if enabled
Tomas Cohen Arazi [Tue, 10 May 2022 17:18:55 +0000 (14:18 -0300)]
Bug 30728: Only trigger real-time holds queue update if enabled

This patch makes the places in which Koha enqueues holds queue for
real time updates verify the feature is enabled.

To test:
1. Apply this patches up to the unit tests
2. Run:
   $ updatedatabase
   $ kshell
  k$ git diff origin/master --name-only | grep -e '\.t$' | xargs prove
=> FAIL: tests fail, the code doesn't care about the syspref
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Be happy!
6. 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: Fridolin Somers <fridolin.somers@biblibre.com>