]> git.koha-community.org Git - koha.git/log
koha.git
3 years agoBug 8426: Diacritics not being mapped for searching
Kyle M Hall [Thu, 12 Jul 2012 11:07:07 +0000 (07:07 -0400)]
Bug 8426: Diacritics not being mapped for searching

Add mappings for ︡a to a, and for t︠ to t.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9140ea69150520f7a9b4fcc453020af91bd6ed38)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27813: Restore default order on suggestion list view
Jonathan Druart [Tue, 2 Mar 2021 11:22:27 +0000 (12:22 +0100)]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by oldest first

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 25f391b00df34f452e341039abf448c780df1d7d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27815: "Remove" in point of sale untranslatable
Owen Leonard [Mon, 1 Mar 2021 12:24:41 +0000 (12:24 +0000)]
Bug 27815: "Remove" in point of sale untranslatable

This patch modifies the Point of Sale template so that the "Remove"
button can be translated. The string in the JavaScript block wasn't
wrapped in the correct function.

To test, apply the patch and test that the correct strings are
translatable. In this example I'm testing fr-FR:

- Update a translation:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for the strings pulled from
  the template: e.g. misc/translator/po/fr-FR-staff-prog.po
- Locate strings pulled from pos/pay.tt for translation to confirm the
  update, e.g.:

  #: koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt:189
  #, c-format
  msgid "Remove"
  msgstr "Enlever"

- Install the updated translation:

  > perl translate install fr-FR

- In the staff client, go to Point of Sale.
- Switch to the French translation and click the "Ajouter" button next
  to one of the items for purchase.
- In the "This sale" table, the item you added should have a
  corresponding "Enlever" button.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0381d9e52407fa7172ac18a85e0db8e62edc6c90)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26199: Include LDR for match check/match point
David Cook [Thu, 17 Dec 2020 04:05:39 +0000 (04:05 +0000)]
Bug 26199: Include LDR for match check/match point

This patch adds the ability to specify the LDR instead of a numeric tag
when defining match checks in record matching rules. This is particularly
useful for checking LDR6 "Type of record" when importing records.

Test plan:
0. prove t/Matcher.t

1. Go to http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=1
2. Click "Save" and choose "MARCXML"
3. Copy bib-1.marcxml to bib-1-mod.marcxml
4. Change "01344cam a22003014i 4500" to "01344cmm a22003014i 4500"
5. Go to http://localhost:8081/cgi-bin/koha/admin/matching-rules.pl?op=edit_matching_rule&matcher_id=3
6. Click "Add match check"
7. Fill out the match checks:
Source:
Tag: LDR
Offset: 6
Length: 1
Target:
Tag: LDR
Offset: 6
Length: 1

8. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
9. Choose "bib-1-mod.marcxml" and click "Upload file"
10. Choose "KohaBiblio (999$c)" for "Record matching rule"
11. Click "Stage for import"
12. Click "Manage staged records" on resulting page
13. Note the "Match type" says "No match"

14. Go to http://localhost:8081/cgi-bin/koha/tools/stage-marc-import.pl
15. Choose "bib-1.marcxml" and click "Upload file"
16. Choose "KohaBiblio (999$c)" for "Record matching rule"
17. Click "Stage for import"
18. Click "Manage staged records" on resulting page
19. Note the Match type says "Match found"

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit baa2260503356af15ad4df835a24abf084ec41a2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27820: add all missing use in misc/cronjobs/plugins_nightly.pl
Fridolin Somers [Mon, 1 Mar 2021 10:40:56 +0000 (11:40 +0100)]
Bug 27820: add all missing use in misc/cronjobs/plugins_nightly.pl

Koha::Plugins and C4::Context where missing.
Try::Tiny was missing for try/catch.

Test plan :
1) Use a plugin using hook 'cronjob_nightly'
2) Run script : misc/cronjobs/plugins_nightly.pl

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5a2dfc5ea36d45d7af9c0e4102f92a601e192b46)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27820: fix missing import in plugins_nightly.pl
Samir Shah [Mon, 1 Mar 2021 07:49:03 +0000 (10:49 +0300)]
Bug 27820: fix missing import in plugins_nightly.pl

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3267648dedd04085f0adaa0bd70979cd839e7344)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24359: (QA follow-up) Fix tests
Tomas Cohen Arazi [Mon, 1 Mar 2021 18:41:21 +0000 (15:41 -0300)]
Bug 24359: (QA follow-up) Fix tests

This patch fixes a rebase issue, and also makes sure the tests do not
rely on any prior data. The query on tmp_holdsqueue is done against the
actual reserve_id so no need to delete all the data from the
tmp_holdsqueue and hold_fill_targets table.

I also noticed the previous subtest wasn't run inside a transaction even
if the code was designed to not depend on prior data as well.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/HoldsQueue.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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ac7d1124ab0db1a532496b2b3f5c0c75a781a20f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24359: Remove hold from holds queue when captured
Agustin Moyano [Wed, 28 Oct 2020 13:48:18 +0000 (10:48 -0300)]
Bug 24359: Remove hold from holds queue when captured

This patch removes a hold from holds queue when captured by check in.

To test:

1. check out an item from a book with multiple items for patron_1
2. place a biblio level hold for patron_2
3. perl misc/cronjobs/holds/build_holds_queue.pl
CHECK => holds queue shows the placed hold
4. check in the item from step 1 and confirm hold for patron_2
SUCCESS => hold for patron_2 is no longer in holds queue
5. prove t/db_dependent/HoldsQueue.t

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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 445ca21ff06ca2e4f3a59d0a70c8bce6533168db)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 24359: Add test
Agustin Moyano [Wed, 28 Oct 2020 13:48:09 +0000 (10:48 -0300)]
Bug 24359: Add test

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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit cdc668764cefde4924291b8d51bd97ec8a4157d1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26964: Newly created macros should be selected in the Advanced editor
Phil Ringnalda [Fri, 26 Feb 2021 21:39:37 +0000 (13:39 -0800)]
Bug 26964: Newly created macros should be selected in the Advanced editor

The problem is that the newly created macro isn't selected, because the
return values from the call to create it are accidentally thrown away. There
isn't actually any option to save, just a timeout that automatically saves,
but you can tell you are in this broken state because the Delete macro
button is disabled.

Test plan:

1. Prior to applying the patch, Administration - set the preference
   EnableAdvancedCatalogingEditor to Enable
2. Cataloging - Advanced editor - Macros... - New macro...
3. Give it a name, click OK, notice that the Delete macro button is disabled
4. Apply patch, shift+reload
5. Macros... - New macro...
6. Give it a name, click OK, notice that the Delete macro button is enabled
7. Type something in the editor, delete 999 will do nicely, wait half a
   second to see Saved appear at the far right, close the macro popup
8. Macros..., click the name of your macro, verify it really was saved

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f17d3dd62cfcbe7de3b74573b48e09e42e6b0eab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27058: (follow-up) Clarify notforloan checks with a comment
Joonas Kylmälä [Fri, 5 Mar 2021 15:26:02 +0000 (17:26 +0200)]
Bug 27058: (follow-up) Clarify notforloan checks with a comment

In IsAvailableForItemLevelRequest the check is for holdability and in
ItemsAnyAvailableAndNotRestricted the check is for
checkoutability. These comments should make it more clear because the
notforloan value is used for these two different purposes and is a bit
confusing (we might want to add a new field "notforhold" in future to
make the code self documenting)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9dcceb66fabc7569040c61fc7838d7d5e888e596)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27058: Add test for IsAvailableForItemLevelRequest and notforloan
Jonathan Druart [Fri, 5 Mar 2021 13:49:22 +0000 (14:49 +0100)]
Bug 27058: Add test for IsAvailableForItemLevelRequest and notforloan

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8c68fa762efe68e7d708c2f41aff7bcb848d69c0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27058: Remove confusing and unnecessary $biblionumber1 variable
Joonas Kylmälä [Fri, 19 Feb 2021 07:49:51 +0000 (09:49 +0200)]
Bug 27058: Remove confusing and unnecessary $biblionumber1 variable

The code is much more understandable now because with $biblio2 and
$biblionumber1 variables use to point to the same biblio one might
have thought $biblionumber1 points to $biblio1 which in this case is
not true. Let's just drop the extra variable because the object
notation of accessing is just as simple.

To test:
 1) prove t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t => passes

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit da81064b8b8b8efc6950084231b1943f25f7820d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27058: Make checkout availability use all notforloan reasons
Joonas Kylmälä [Thu, 19 Nov 2020 14:55:18 +0000 (16:55 +0200)]
Bug 27058: Make checkout availability use all notforloan reasons

The ItemsAnyAvailableAndNotRestricted function is checking whether an
item can be checked out and it incorrectly only checks the positive
notforloan values when there can be also negative notforloan
values. If notforloan value is not 0 then it means the item cannot be
checked out. In the case of ordered items the value is negative (-1)
and thus before this change the checkout availability was reported
incorrectly.

To test:
 1) Run prove t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t
    Notice it fails
 2) Apply this patch
 3) Run prove t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t
    Notice it passes now.

To test via Koha sandbox (Alternatively):
 1) Create circ rule with If all unavailable
 2) Create new biblio
 3) Order a new item to the biblio via acquisitions and set the not
    for loan value to Ordered / -1
 4) Notice you cannot place a hold to the biblio
 5) Apply patch
 6) Notice you can now place a hold to the biblio

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 18128cc810a00a46f8d4af19bebaa4c562761456)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27058: Add test to show ordered items cannot be checked out
Joonas Kylmälä [Thu, 19 Nov 2020 15:13:25 +0000 (17:13 +0200)]
Bug 27058: Add test to show ordered items cannot be checked out

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1c0acc36ba1b075add4c930c7fd875cf75b8a476)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27650: Fix variable passed to the template in opac-main
Jonathan Druart [Wed, 10 Feb 2021 06:26:15 +0000 (07:26 +0100)]
Bug 27650: Fix variable passed to the template in opac-main

$template->param(
+    koha_news           => @all_koha_news,

We must not pass an array, the number of elements of the hash passed to the template may be inconsistent.

It's working because of an error earlier in the script:
+    @all_koha_news   = &GetNewsToDisplay($news_lang,$homebranch);

GetNewsToDisplay returns an arrayref

Test plan:
Define at least 2 news to display on the OPAC main page
Hit opac-main.pl
=> All news are displayed
Click one
=> You see the single news you selected

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ca4ef19a2bb400d4348ee84eaddf6af0c429d1c7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27745: prevent warning for uninitialized value as a hash key
Petro Vashchuk [Wed, 3 Mar 2021 09:32:48 +0000 (11:32 +0200)]
Bug 27745: prevent warning for uninitialized value as a hash key

When you edit and save items with an empty "c - Shelving location"
field, it gets stored into the database as "NULL",
which is allowed in the database, and the field is not "required",
so this seems expected.

But when the search page is rendered, it gets value by location key
($shelflocations->{ $item->{location} }) which gives undef warning.

Solved by checking if $item->{location} is perl true.

To reproduce:
    1) Edit the book or create new one with an empty shelving location.
    2) Use the search feature to have that book in the searched list.
    3) Check plack-intranet-error.log to find "Use of uninitialized
value in hash element" error.
    4) Apply the patch.
    5) Repeat the search and check the logs again to ensure that error
didn't appear again.

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ebf123bf139b28d274ade70016c1af0e3aeffb1b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27795: Misalignment of TOTAL value in lateorders page
Owen Leonard [Thu, 25 Feb 2021 14:20:14 +0000 (14:20 +0000)]
Bug 27795: Misalignment of TOTAL value in lateorders page

This patch corrects the colspan in the footer of the late orders page.

It also adds a quantity total cell to the footer and changes the
container of the buttons at the bottom of the page from a <p> tag to
the standard <fieldset class="action">.

To test, apply the patch and go to Acquisitions -> Late orders.

In the footer of the late orders page, there should be a total under the
"Quantity" column. The total cost number should be correctly aligned
under the "total cost" header cell.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 42a32bc1727dc4723e07a83cc53e5951a09a20b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27752: Correct eslint errors in batchMod.js
Owen Leonard [Mon, 22 Feb 2021 15:44:54 +0000 (15:44 +0000)]
Bug 27752: Correct eslint errors in batchMod.js

This patch makes minor changes to batchMod.js in order to address errors
raised by ESLint. These changes include whitespace changes, so diff
accordingly.

To test, apply the patch and go to Tools -> Batch item modification.

- Submit a batch of barcodes for modification.
- Uncheck some checkboxes to hide columns in the table showing your
  submitted items.
- Return to the batch item modification page and submit your batch
  again.
- The columns you selected should still be hidden.
- Submit a batch of items for deletion.
- The same columns should be hidden here too.

To confirm that ESLint is happy with the changes you could open the file
for editing using an editor with ESLint integration, or install ESLint
on the command line:
https://eslint.org/docs/user-guide/command-line-interface

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4add0cbc2d6c3aec6e71d6148ed86cc2e811d1ef)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27777: (alternate) Improve tables on Point of Sale page for low screen resolutions
Owen Leonard [Wed, 24 Feb 2021 16:58:28 +0000 (16:58 +0000)]
Bug 27777: (alternate) Improve tables on Point of Sale page for low screen resolutions

This alternate solution makes these minor changes:

- The Bootstrap grid classes are adjusted so that the breakpoint
  between the two-column layout and the single-column layout happens at
  a wider browser-width.
- The DataTable configurations are modified to set "autoWidth" to
  "false," which gives us a more fluid behavior.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 63ce989b610ea21044e57ccc5fdf04c06c53bd46)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27776: Remove default sort order of sales table
Martin Renvoize [Wed, 24 Feb 2021 15:53:13 +0000 (15:53 +0000)]
Bug 27776: Remove default sort order of sales table

This patch drops the default sort on table initialisation so that the
table remains sorted in the order in which items are added unless the
user explicitly chooses to apply a sort order.

We also correct a mistake in the targets for disabling sorting on the
'Actions' column and update the hidden 'CODE' column to use the same
syntax as the other definitions for consistency.

Test plan
1/ Enable the point of sale system and set some debit types to allow
sale.
2/ Navigate to the point of sale page and added some items to sell
3/ Update the price for a few lines and note the sort order does not
change.
4/ Update the quantity for a few lines and note the sort order does not
change.
5/ Sort a column using the headers and note it works
6/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 755081fdc394bbf457bee00acf1037a0ba6b29f0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27717: Display date of birth even if the patron is under 1
Martin Renvoize [Wed, 17 Feb 2021 12:25:34 +0000 (12:25 +0000)]
Bug 27717: Display date of birth even if the patron is under 1

This patch moves the 'age' condition to below the date of birth display,
allowing the date to display for babies.

Test plan
1/ Add a user with a date of birth within the last year
2/ Check that the date of birth appears on the patron details page
(under contact details) with the patch applied.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 35b5e29988f9781516b7e09327741455bfa202a5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26742: Remove die from connect
Jonathan Druart [Mon, 14 Dec 2020 09:05:02 +0000 (10:05 +0100)]
Bug 26742: Remove die from connect

The change was not advertised and it needs to be done on a separate bug
report (+ test coverage)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 0104de7c22d1370c836703b683c9cc8112275da5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26742: Add configuration to koha-conf.xml for message broker
David Cook [Tue, 20 Oct 2020 00:54:46 +0000 (11:54 +1100)]
Bug 26742: Add configuration to koha-conf.xml for message broker

The connection details for the message broker should be configurable.
This patch adds configuration options to koha-conf.xml. If they
are not specified, then default connection details will be used.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8663f23a931edea9f8fcd341e67804f613bb1d8d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27048: (follow-up) Correction to elapsed printing
Martin Renvoize [Mon, 1 Mar 2021 14:00:39 +0000 (14:00 +0000)]
Bug 27048: (follow-up) Correction to elapsed printing

JD Amended patch: Remove perlcritic error
"$d" is declared but not used at line 839, column 5.  Unused variables clutter code and make it harder to read.  (Severity: 3)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ecb56647632305132fd32eece0a5bf89b018689c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27048: Add basic timekeeping to rebuild_zebra
Martin Renvoize [Wed, 18 Nov 2020 10:36:43 +0000 (10:36 +0000)]
Bug 27048: Add basic timekeeping to rebuild_zebra

This patch adds a start time, end time and elapsed times on the 'records
exported' lines to the verbose output of the rebuild_zebra.pl script.

Test plan
1/ Run rebuild_zebra.pl -a -b -v
2/ Note the new timestamps included on the verbose output
3/ Signoff

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fe1705f947952fa5b4238c802f5d024cf3d7b7e1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: (follow-up) Supress warning about unitialized string
Joonas Kylmälä [Thu, 4 Mar 2021 10:33:24 +0000 (12:33 +0200)]
Bug 25690: (follow-up) Supress warning about unitialized string

This fixes the warning:
Use of uninitialized value in string eq at /kohadevbox/koha/C4/Reserves.pm line 860.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 17479dd3f942098b165ba15a2739ad6949ae6dc4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: (follow-up) Correct grammar in warning messages
Joonas Kylmälä [Fri, 26 Feb 2021 11:33:15 +0000 (13:33 +0200)]
Bug 25690: (follow-up) Correct grammar in warning messages

This makes the meaning of the warnings a bit more clear.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 948b7ff598e5af001126ae3168877c0a8a896559)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: (QA follow-up) PROCESSED -> PROCESSING for consistency
Martin Renvoize [Fri, 19 Feb 2021 12:06:10 +0000 (12:06 +0000)]
Bug 25690: (QA follow-up) PROCESSED -> PROCESSING for consistency

PROCESSED gave the apearance that the item processing had been completed
whereas in reading the code it appears to actually signify that the item
is awaiting/in proessing state.

This patch updates the variable to be PROCESSING consistently throughout
the codebase.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1b289f74cc5b08a87e8d5b612f946a930c5e7e24)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: Add SIP2 tests for checking out with holds
Joonas Kylmälä [Thu, 18 Feb 2021 15:37:36 +0000 (17:37 +0200)]
Bug 25690: Add SIP2 tests for checking out with holds

This should cover whether checking out is allowed for all different
hold states:

Attached:
 - Waiting
 - In processing
 - Transfer

Unattached:
 - Reserved

To test:
 1) prove t/db_dependent/SIP/Transaction.t => passes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2f5fc09f2fe77204c62fc2307b4e2ee71ce9e2f3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: Make CanBookBeIssued return In Processing state as needing confirmation
Joonas Kylmälä [Wed, 17 Feb 2021 14:20:28 +0000 (16:20 +0200)]
Bug 25690: Make CanBookBeIssued return In Processing state as needing confirmation

This prevents checking out to a patron an item with hold to someone
else in the In Processing state via staff interface.

Also the checkout error message via SIP is now a more clearer one: "Item is
on hold for another patron." Before it was "Item cannot be issued:
$confirmation".

Also the branch transfer and batch checkout pages are adapted to this new
confirmation message as well.

To test:
 1) Create bib level hold to an item for patron A
 2) Check-in that item via SIP2, now the hold state should be "In processing"
 3) Apply patch
 4) Try to checkout the item to patron B via staff interface and
    notice we get now confirmation prompt do we really want to do it
    because it is in processing.

 In order to not have to setup SIP2 server, alternatively steps 1) and
 2) can be done so that you check-in the item in staff interface and
 make it Waiting, and then with SQL change it to "In processing":

 UPDATE reserves SET found = "P" WHERE reserve_id = XXX;
 UPDATE reserves SET waitingdate = NULL WHERE reserve_id = XX
 UPDATE reserves SET expirationdate = NULL WHERE reserve_id = XXX;

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fd0bc2204c2a99e5bb61cdda88eb173ee6d81f2a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: Remove duplicated logic in SIP2 checkouts
Joonas Kylmälä [Wed, 17 Feb 2021 12:17:36 +0000 (14:17 +0200)]
Bug 25690: Remove duplicated logic in SIP2 checkouts

Because AllowItemsOnHoldCheckoutSIP only affects the checkoutability
of non-attached, i.e. RESERVED holds in SIP2 we can therefore use the
common code from CanBookBeIssued and ignore only the RESERVED confirmation
message case in SIP2 checkout code.

This slightly changes the checkout error message given for "In
processing" holds that someone other than the holdee tries to
checkout. Otherwise there is no logic changes. The message that this
changes is "Item is on hold for another patron." vs. now "Item cannot
be issued: $confirmation". It is easier to create follow-up patch to
properly add INPROCESSING confirmation to CanBookBeIssued and then
show correct message based on the CanBookBeIssued return value.

To test:
 1) Apply all patches from bug 25690 to get latest Transaction.t version
 2) prove t/db_dependent/SIP/Transaction.t => passes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 338ba1d7692c1f75af7b0fb75eb5aac00a04a3df)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: SIP2: Don't allow checking out attached hold that is being transferred
Joonas Kylmälä [Wed, 17 Feb 2021 12:28:03 +0000 (14:28 +0200)]
Bug 25690: SIP2: Don't allow checking out attached hold that is being transferred

Items that are attached to a hold and being transferred (found = T) is
final decision and you cannot checkout those to other patrons.

To test (if you have applied all patches from bug 25690):
 1) prove t/db_dependent/SIP/Transaction.t => passes

To test (if you don't have all patches):
 1) Create hold and set pickup library to something else where the
    item is at
 2) Return the item and it should confirm the hold and start transfer
 3) Apply this patch
 4) Try to checkout this item now to some other patron via SIP2 and
    notice it doesn't allow it
 5) Revert this patch
 6) Notice you can now checkout somebody else's hold that is being transferred!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9b5913d308e4aa03306c5275d0e638e922a6db32)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25690: Remove double usage of 'Reserved' return value
Joonas Kylmälä [Wed, 17 Feb 2021 12:04:47 +0000 (14:04 +0200)]
Bug 25690: Remove double usage of 'Reserved' return value

The patch "Bug 19116: Hold not set to waiting after transfer" added a
new meaning to 'Reserved' return value of C4::Reserves::CheckReserves
function. Let's remove double usage and have separate Transferred
return value so we can differentiate between attached and non-attached
holds. This will come useful in future refactorings.

This patch does no changes to the logic except in the
/cgi-bin/koha/circ/branchtransfers.pl and circulation.pl we now give
similarly to waiting state notice about hold being transferred.

To test:
   1) Apply this patch
   2) Create a new item level hold so that pickup library is different
   than where the item is currently. Then return the item so that hold
   is being attached and transferred.
   3) Go to branchtransfers.pl and try to create a new transfer: it
   should prompt you with message "Item is attached to a hold and
   being transferred for XXX" and provide you with option to cancel
   the hold or to ignore the transfer.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fbef5478325bbc71064f9ecb3c4c50eaed0b223d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26363: Remove tmp file during package build (follow-up)
Mason James [Thu, 4 Mar 2021 02:41:12 +0000 (15:41 +1300)]
Bug 26363: Remove tmp file during package build (follow-up)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bf06f36fd0d1f76865c269931375f823c300352f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27703: Make ID of category select field unique
Owen Leonard [Tue, 16 Feb 2021 13:27:34 +0000 (13:27 +0000)]
Bug 27703: Make ID of category select field unique

Duplicate element IDs on the authorized values page are invalid and
cause a problem with the JavaScript intended to submit the form when the
category select field changes.

This patch changes the ID of the label and the field and makes the
corresponding change to the JavaScript.

To test, apply the patch and go to Administration -> Authorized values.

 - Click an authorized value category to view its contents.
 - Using mouse or keyboard, make a selection from the "Show category"
   dropdown menu.
 - The form should submit automatically and direct you to the
   corresponding category.
 - Validate the HTML of the page and confirm that there are no errors.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fa349d4cf1c28d486be89c9d84f18fddbaeaf5db)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27784: Don't parse subdivision authorities as headings
Nick Clemens [Fri, 26 Feb 2021 14:28:42 +0000 (14:28 +0000)]
Bug 27784: Don't parse subdivision authorities as headings

Subdivision authorities are not used for linking, however, they are recognized by
C4::AuthoritiesMarc

While these records are not used for linking, they could provide reference and
should be allowed to exist in the catalog without breaking ES indexing

THis patch simply skips the step of parsing the authorities into the linking form
if the type contains '_SUBD'

To test:
1 - Import a subdivision authority record via Z39 or use the one attached to this bug
2 - perl misc/search_tools/rebuild_elasticsearch.pl -v -d
3 - Authority indexing dies:
   Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 202.
   Use of uninitialized value $tag in regexp compilation at /usr/share/perl5/MARC/Record.pm line 206.
   Use of uninitialized value $tag in hash element at /usr/share/perl5/MARC/Record.pm line 207.
   Can't call method "tag" on an undefined value at /kohadevbox/koha/C4/Heading.pm line 71.
4 - Apply patches
5 - reindex
6 - Success!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d67fc5e010f5efba79980626beed88755f420c48)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27784: Unit tests
Nick Clemens [Fri, 26 Feb 2021 14:28:16 +0000 (14:28 +0000)]
Bug 27784: Unit tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 5e0dbf0adb63818b08ee77843706255dcaf00051)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27828: (bug 24469 follow-up) Add missing import
Jonathan Druart [Tue, 2 Mar 2021 10:36:49 +0000 (11:36 +0100)]
Bug 27828: (bug 24469 follow-up) Add missing import

Caused by
  commit 03a9bdc851dcfe114c1676ac55def1e1c5d51970
  Bug 24469: Move the new queries to a dedicated ImportBatch subroutine

Undefined subroutine &CGI::Compile::ROOT::kohadevbox_koha_acqui_neworderempty_2epl::SetMatchedBiblionumber called at /kohadevbox/koha/acqui/neworderempty.pl line 183

Test plan:
Create a new order from a staged file, select "Add order" next to a
title

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7b4be9486e6e37e724560863f36e4835b6a66f43)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27822: Fix default value for AddressFormat (es-ES)
Jonathan Druart [Tue, 2 Mar 2021 15:08:51 +0000 (16:08 +0100)]
Bug 27822: Fix default value for AddressFormat (es-ES)

It must be "us" not "US" otherwise you get
Template process failed: file error - member-main-address-style-US: not found at /usr/share/koha/lib/C4/Templates.pm line 122" because the system expects "us", not "US".

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2542687f68d67ec1b36b1c1994920827515ce0a0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27808: (QA follow-up) Make sure the update catches the items we want
Tomas Cohen Arazi [Mon, 1 Mar 2021 14:56:23 +0000 (11:56 -0300)]
Bug 27808: (QA follow-up) Make sure the update catches the items we want

This query:

SELECT *
FROM items
LEFT JOIN issues
ON issues.itemnumber=items.itemnumber
WHERE items.onloan IS NULL;

returns 961 rows on the sample data, with 2 items checked out and onloan
set to NULL.

With this tweak, the query only matches the 2 checkout items with onloan
set to NULL:

SELECT *
FROM items
LEFT JOIN issues
ON issues.itemnumber=items.itemnumber
WHERE items.onloan IS NULL AND issues.issue_id IS NOT NULL;

This is the query that needs to be used on the atomic update for
filtering the items to be updated.

This patch does that.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8df3e02885f94ef8a6f960f693c398b6646daf09)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27808: DBRev 20.12.00.018
Jonathan Druart [Mon, 1 Mar 2021 14:10:40 +0000 (14:10 +0000)]
Bug 27808: DBRev 20.12.00.018

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit aa41987dbfebcd61e1a7b5847095f55261c55d5e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27808: DB changes - adjust items.onloan when needed
Jonathan Druart [Mon, 1 Mar 2021 12:34:56 +0000 (13:34 +0100)]
Bug 27808: DB changes - adjust items.onloan when needed

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bb2758839e56c78b5f4d47f28d26053a29ae4d68)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27808: Refresh the item object when AddReturn is called
Tomas Cohen Arazi [Fri, 26 Feb 2021 19:55:59 +0000 (16:55 -0300)]
Bug 27808: Refresh the item object when AddReturn is called

This patch changes the original implementation so the item object is
refreshed altogether instead of explicitly pinpointing a specific field
we identified an edge case can leave out from ->store. I propose this
alterate implementation because what this bug highlights is the fact we
don't code thinking calls to things can have side-effects (like this
case, with AddReturn updating the onloan status (and maybe other
things?).

To test:
1. Make sure circ tests pass with and without this patch

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 26b57ad5d20e385ff922cc8737afebfece17a3cf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27808: Mark the onloan column as dirty in AddIssue
Kyle M Hall [Fri, 26 Feb 2021 14:56:07 +0000 (09:56 -0500)]
Bug 27808: Mark the onloan column as dirty in AddIssue

If any item is currently checked out to a patron, and the item is then checked out directly to another patron without manually checking the item in first, the items.onloan column will remain NULL.

This will only happen if the new checkout will be due the same day as the previous checked.

This is caused by the item being returned without updating the item object from storage afterward. Even though AddIssue will call AddReturn which sets the value of onloan to NULL in the database, we are not passing in the item object by reference, so it's onloan value remains set to a date. Then we set the onloan value to the same date. Because the value does not change in the object, the column does not get marked dirty.

We could update the object from storage first, but it seems more efficient to mark the column as dirty manually to avoid that otherwise unnecessary fetch.

Test Plan:
1) Apply these patches
2) prove t/db_dependent/Circulation.t

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marti Fuerst <mfuerst@hmcpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 44a54eb526eff58b860d699ee3c5fb11b3b25fab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27808: Add unit tests
Kyle M Hall [Fri, 26 Feb 2021 14:44:30 +0000 (09:44 -0500)]
Bug 27808: Add unit tests

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marti Fuerst <mfuerst@hmcpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 36c49aa2a865a069592c5d7695127252a3007f44)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27794: Add link to biblio in lateorders page
Owen Leonard [Thu, 25 Feb 2021 14:03:43 +0000 (14:03 +0000)]
Bug 27794: Add link to biblio in lateorders page

This patch modifies the late orders page so that the late order title
uses the "biblio-title" include to display a standard title with a link
to the bibliographic detail page.

To test, apply the patch and go to Acquisitions -> Late orders.

In the table of late orders, confirm that the title display correctly
and links to the correct bibliographic record.

Signed-off-by: Severine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 12d50cb5d8529d993ef5abccd84535540c938bee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27792: (follow-up) Double escape the escape
Martin Renvoize [Thu, 25 Feb 2021 13:55:15 +0000 (13:55 +0000)]
Bug 27792: (follow-up) Double escape the escape

The JSON patturn wasn't getting interpreted correctly for me.. the `\`
characters needed escaping with a second `\`.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f8a92cb8e8b731f1526500f32cf115dbd5636cf6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27792: Improve jEditable configuration for point of sale fields
Owen Leonard [Thu, 25 Feb 2021 12:15:02 +0000 (12:15 +0000)]
Bug 27792: Improve jEditable configuration for point of sale fields

This patch alters the configuration of the "cost" and "quantity"
editable fields in the "This sale" table on the Point of Sale page:

 - Reduce field with to reduce jumpy table re-draws.
 - Replace "numeric" input type with "text"
 - Add pattern attribute for enforcing currency/number entry

To test you must have EnablePointOfSale and UseCashRegisters enabled and
configured.

 - Apply the patch and go to the Point of Sale page.
 - Add some items for purchase.
 - In the "This sale" table, click the values in the "cost" and
   "quantity" columns and try editing their values.
 - The form field which appears should not fill the width of the table
   column.
 - The fields should enforce the correct input: Currency for the "cost"
   column, digits for the "quantity" column.
 - The fields should update when you click out of them and the correct
   values should appear in the "Collect payment" area.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 50c4efb18dc4e666d60e57f8412d6553eccbfe72)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26591: SIP option prevcheckout_block_checkout to block checkout of previously...
Matthias Meusburger [Tue, 3 Nov 2020 14:49:31 +0000 (14:49 +0000)]
Bug 26591: SIP option prevcheckout_block_checkout to block checkout of previously checked-out documents

This patchs adds a new SIP option to block checkout of previously
checked-out documents: prevcheckout_block_checkout

See the CheckPrevCheckout system preference to enable previously
checked-out verification in Koha.

Test plan:
  1) Apply this patch
  2) Enable the CheckPrevCheckout syspref (on "Do" for instance)
  3) Enable prevcheckout_block_checkout in the SIP server config file
  4) Checkout and checkin an item for a user
  5) Checkout the item again with the SIP CLI tool
  6) Check that the SIP message is "This item was previously checked out by you"
     and that the item was not checked out
  7) Disable prevcheckout_block_checkout in the SIP server config file
  8) Checkout the item again with the SIP CLI tool
  9) Check that the SIP message is "This item was previously checked out by you"
     and that the item was checked out.
 10) Prove t/db_dependent/SIP/Message.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 86918091118d1e2ead99a943dfe783c7f1740789)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27316: DBRev 20.11.03.003
Jonathan Druart [Mon, 1 Mar 2021 14:10:39 +0000 (14:10 +0000)]
Bug 27316: DBRev 20.11.03.003

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 482d77b536ed89b9c6b354ab50dfb4a86fa472ca)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27316: (follow-up) Default to 1 if undef in mappings
Nick Clemens [Fri, 8 Jan 2021 13:13:48 +0000 (13:13 +0000)]
Bug 27316: (follow-up) Default to 1 if undef in mappings

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e1d85738cca1acb0f2b1617d5607bfd644cb7b99)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27316: Convert 'undef' for sort to Yes and use Yes/No instead of 0/1
Nick Clemens [Thu, 7 Jan 2021 20:14:33 +0000 (20:14 +0000)]
Bug 27316: Convert 'undef' for sort to Yes and use Yes/No instead of 0/1

This patch changes the interface to remove the undef option
We also update existing mappings and set default of 1

Comment previously indicated undef was treated differently, but in the code we treat undef as 1
That code is untoched to avoid creating problems for older mappings that may be reloaded

To test:
1 - View the ES mappings, note you can set columns to Undef, 0, 1
2 - Set some to undef
3 - Apply patches
4 - Update database
5 - Undef now show as 'Yes'
6 - Confirm you can set columns as Yes/no
7 - Confirm that mandatory columns display correct value when readonly (see issues field)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9dd997e2d38a0ec07411166e5e497d48d95f9437)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27680: (QA follow-up) Update test for dbic_merge_sorting
Martin Renvoize [Tue, 2 Mar 2021 08:56:14 +0000 (08:56 +0000)]
Bug 27680: (QA follow-up) Update test for dbic_merge_sorting

The order_by handling will now always return an arrayref of ordering
hashrefs even when only one ordering hash is present. This is
interpreted by dbic as equivilent so I just update the test to pass
here.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 96aa6877ae39c987214e46d00c70c76591da0174)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27680: Add support for param[] syntax
Tomas Cohen Arazi [Fri, 26 Feb 2021 17:44:23 +0000 (14:44 -0300)]
Bug 27680: Add support for param[] syntax

While not that common nowadays, it is the syntax PHP uses, and
DataTables also generates such thing in 'traditional' mode. We should
support it as well.

This patch adds support for that. It does so by adding _order_by[] to
the reserved param names, and proper handling on the dbic_merge_sorting
helper.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 27680: (QA follow-up) Minor perlcritic issue

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 79064a88639ba725cc898cb940c85ff3fb1d4bee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27680: Allow traditional multi-params to work
Martin Renvoize [Fri, 12 Feb 2021 19:25:10 +0000 (19:25 +0000)]
Bug 27680: Allow traditional multi-params to work

This patch allows the preceeding test to pass. Strictly, we want a comma
delimited string for our _order_by parameter, but we cannot easily block
a traditional multi-passed parameter.  As such the 'nice' thing to do is
handle it when such a thing is passed as it will pass through validation
regardless.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bc23981b46e67a6d9ee91a2065293ac472341bed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27680: Add tests for various ways of passing multi-params
Martin Renvoize [Fri, 12 Feb 2021 14:05:13 +0000 (14:05 +0000)]
Bug 27680: Add tests for various ways of passing multi-params

This patch adds unit test to increase the coverage of parameter that
accept multiple values.  There are a number of different ways end users
can send such parameters and we should test to ensure we are recieving
the correct option.

Options
`?param1=this&param1=that` - traditional multiple pass params
`?param1[]=this&param1[]=that` - php multiple pass params
`?param1=this,that` - comma delimited list param
`?param1=this|that` - pipe delimited list param

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d2a43a77aabd9cf885d6dc9b72458a00bbc28ac9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27680: Add support for sorting fields with multiple data points
Martin Renvoize [Fri, 12 Feb 2021 13:14:16 +0000 (13:14 +0000)]
Bug 27680: Add support for sorting fields with multiple data points

This patch adds proper handling for sorting a single column that is
constructed of multiple data entities.. i.e `"data": "string1:string2"`

It does NOT add support for filtering on multiple columns yet.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fa1671aba529e55f124eb759f3b09e237a7282fe)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27680: Take first order column for ordering
Jonathan Druart [Fri, 12 Feb 2021 09:53:27 +0000 (10:53 +0100)]
Bug 27680: Take first order column for ordering

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ba7f51f3d12fe2a66b8094d9a10a234a3f4e7c4d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27754: Correct eslint errors in basket.js
Owen Leonard [Mon, 22 Feb 2021 17:51:16 +0000 (17:51 +0000)]
Bug 27754: Correct eslint errors in basket.js

This patch makes minor changes to basket.js in the staff interface
templates in order to quiet warnings from ESLint. Besides whitespace,
most changes are to correct undeclared or unnecessarily declared
variables.

To test, apply the patch and verify that the cart still works
correctly.

 - Perform a catalog search in the staff interface.
 - Test adding single or multiple items to the cart from the search
   results page.
 - Testing adding and removing titles to the cart from the bibliographic
   detail page.
 - Open the cart and test the various controls in the toolbar to confirm
   that they still work correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ae62da0ff6a3fa5df3e01fce656fccc02ce6a55e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27578: Initialize searchid as blank when not populated
Nick Clemens [Fri, 29 Jan 2021 13:47:22 +0000 (13:47 +0000)]
Bug 27578: Initialize searchid as blank when not populated

This patch simply sets the searchid to a blank string if not passed in

To test:
1 - Add a new biblio and save it
2 - Check the logs: /var/log/koha/kohadev/plack-intranet-error.log (or similar)
3 - Note warn about uninitialized value
4 - Apply patch
5 - Add a new biblio
6 - No warn

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7f0b0e0556127c9ed191b1b741c4cf466b28e1d6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 25777: Disable misleading datatables table information display z3950
David Cook [Wed, 17 Jun 2020 04:34:02 +0000 (04:34 +0000)]
Bug 25777: Disable misleading datatables table information display z3950

This patch disables the table information display on z3950_search.pl,
since it only includes search result counts for that page, which is
misleading to end users.

To test:
1)  Do not apply the patch
2)  Do a Z39.50 search from cataloguing for "test" against Library of
    Congress.
3)  Note the bottom of the page says "Show 1 to 20 of 20" and
    "Showing page 1 of 501"
4)  Do a Z39.50 search from Acquisitions for "test" against Library of
    Congress (Acquisitions -> Vendor -> Basket -> Add to basket -> From
    external source).
5)  Apply the patch and restart Plack
6)  Repeat Step #2
7)  Note the bottom of the page now only says "Showing page 1 of 501"
8)  Note the search bar is gone
9)  Repeat step #4
10) Note the bottom of the page now only says "Showing page 1 of 501"
11) Note the search bar is gone

Squashed and mixed authorship added below
Co-authored-by: Owen Leonard <oleonard@myacpl.org>
Co-authored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2a2a04a641289f6043971dd98037e02fbb30f64f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27798: Add warning to IndependentBranches system preference
Kyle M Hall [Thu, 25 Feb 2021 18:33:31 +0000 (13:33 -0500)]
Bug 27798: Add warning to IndependentBranches system preference

Test Plan:
1) Apply this patch
2) Search system preferences for IndependentBranches
3) Note the warning about changing the setting on a production system

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
JD Amended patch:
* Fix commit title
* Don't split the syspref's description, otherwise the sentence will be
split in the POs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fa8a60ddc8ac45404b6159fde5c758e4b0dad60b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 7806: DBRev 20.11.03.002
Jonathan Druart [Mon, 1 Mar 2021 10:27:20 +0000 (10:27 +0000)]
Bug 7806: DBRev 20.11.03.002

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3710f34f1b3ec73e44824ead8fb16a2c9e81c072)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 7806: (follow-up) Update to use sanitize_zero_date
Martin Renvoize [Wed, 24 Feb 2021 15:07:38 +0000 (15:07 +0000)]
Bug 7806: (follow-up) Update to use sanitize_zero_date

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6ede97e3aeb761a93c60e89623855f7aa3f49d53)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 7806: Fix remaining occurrences of 0000-00-00
Jonathan Druart [Fri, 18 Dec 2020 14:16:11 +0000 (15:16 +0100)]
Bug 7806: Fix remaining occurrences of 0000-00-00

We should remove all SQL queries that contain 0000-00-00 and finally
assume we do not longer have such value in our DB (for date type)

We already dealt with such values in previous update DB entries.
The 2 added by this one haven't been replaced already.

The code will now assume that either a valid date exist, or NULL/undef.

Test plan:
QA review is needed and test of the different places where code is
modified.

Not sure about the change from reports/issues_avg_stats.pl

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 099e2fe2b700c388e4939b2b2505773056d3383e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27821: Make sanitize_zero_date support datetime and timestamp
Jonathan Druart [Mon, 1 Mar 2021 10:14:32 +0000 (11:14 +0100)]
Bug 27821: Make sanitize_zero_date support datetime and timestamp

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3e3803ee20dc3dfc3d21e5cafa7a76159c8d4aba)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26363: Change SyslogIdentifier to match koha-worker script style
David Cook [Tue, 5 Jan 2021 05:08:54 +0000 (05:08 +0000)]
Bug 26363: Change SyslogIdentifier to match koha-worker script style

This patch changes the SyslogIdentifier so that it matches
the style used by koha-worker.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 782ae187797d27ead5405a591cbfa203a5f0c58e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26363: Provide a systemd unit file for koha-worker in package installs
David Cook [Tue, 6 Oct 2020 06:33:05 +0000 (06:33 +0000)]
Bug 26363: Provide a systemd unit file for koha-worker in package installs

While the packages already have a koha-zebra script that creates a service
using the 'daemon' utility, this unit file template provides an alternative.

Note that currently you'd have to start the service using the following:

```systemctl start koha-worker@NAME.service```

Where NAME is the name of your Koha instance.

The systemctl enable/start commands could be automated more with helper
scripts in debian/scripts, but this is a first step.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6e21b86f66938c12ddc62b06ac08c9e510ef2e8e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26363: Provide a systemd unit file for koha-worker for source installs
David Cook [Tue, 6 Oct 2020 06:30:56 +0000 (06:30 +0000)]
Bug 26363: Provide a systemd unit file for koha-worker for source installs

This patch adds a systemd unit file which gets rewritten according to
the configuration specified by Makefile.PL. This can be linked or
copied to systemd directories for running a systemd service for
background_jobs_worker.pl

Test plan:
1. perl Makefile.PL
1a. Choose "single" installation
1b. Choose "/opt/koha" for a file path
2. make
3. vi blib/KOHA_CONF_DIR/koha-worker.service
4. Verify that PERL5LIB, KOHA_CONF, ExecStart, and SyslogIdentifier
all appear to be correctly filled in

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 21a850a3dccc07bd5b6423bc8c9a902aba7958fc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26457: (QA follow-up) Switch to PK index in UPDATE on issues
Marcel de Rooy [Fri, 26 Feb 2021 10:26:27 +0000 (10:26 +0000)]
Bug 26457: (QA follow-up) Switch to PK index in UPDATE on issues

The deadlock reports tell us that multiple transactions are
waiting for a X lock on a record but using a secondary index
on borrowernumber and itemnumber. Since we have the issue_id
at hand already, we should use that and benefit from the clustered
index (on PK) instead of using a secondary index.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3beeb020ef7d8ef733f34ffef5202bb328a8b867)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26457: Unit test
Nick Clemens [Thu, 24 Dec 2020 12:22:49 +0000 (12:22 +0000)]
Bug 26457: Unit test

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e05ad0c1f827c9670f7bfb7f2112c380f0da5c04)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26457: Throw exception if update of issues table fails
Nick Clemens [Fri, 4 Dec 2020 12:03:52 +0000 (12:03 +0000)]
Bug 26457: Throw exception if update of issues table fails

While this won't prevent the deadlock, it should catch the case where
a deadlock causes the DB update to fail and provide feedback to the user
and rollback the transaction

I don't know how to trigger the deadlock, I can only confirm that we see it, and
that this should catch it.

To test:
1 - Apply patches
2 - Checkout several items to a patron
3 - Confirm that 'Renew all' feature continues to work as expected and all items are renewed

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4062116352e6136e846f8a1c0567323c2c122213)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27071: (follow-up) Get rid of loop
Tomas Cohen Arazi [Mon, 22 Feb 2021 12:27:12 +0000 (09:27 -0300)]
Bug 27071: (follow-up) Get rid of loop

This patch gets rid of a loop on the librarary's groups siblings, and
acknowledges ->get_hold_libraries returns a proper Koha::Libraries
iterator that can be chained with a new query on the passed branchcode.
This way we only fetch  a count from the DB and no loop needs to take
place on the code.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3495a7e9af70706e3ebba60e3fac7aa3845d1d78)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27071: (follow-up) Provide a more meaningful error message
Tomas Cohen Arazi [Tue, 9 Feb 2021 15:26:50 +0000 (12:26 -0300)]
Bug 27071: (follow-up) Provide a more meaningful error message

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 3e8e15cc64a8b09fc9575af4b9fcbae437293715)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27071: Use GetReservesControlBranch to pick the branch
Tomas Cohen Arazi [Tue, 9 Feb 2021 15:14:19 +0000 (12:14 -0300)]
Bug 27071: Use GetReservesControlBranch to pick the branch

Pretty much like the opac-reserve.pl does, this patch makes the staff
request.pl script get the branch from the specialized routine from
C4::Reserves instead of falling back to userenv.

To test:
1. Follow the original test plan:
- Create two local hold groups containing distinct lists of libraries.
- In default rules for all libraries, set Hold Policy = "From local hold group" and Hold pickup library match to "Patron's hold group"
- Make sure AllowHoldPolicyOverride is set to Don't Allow

- Make sure you're logged in at a library in Group 1
- Find a bib with only 1 item from Group 1. Confirm you can place a hold on this title for a patron in Group 1 (correct), but not for a patron in Group 2 (correct).
- Find a bib with only 1 item from Group 2. Confirm you cannot place a hold for a patron from Group 1 (correct), BUT you also cannot place a hold for a patron from Group 2 (incorrect) -- Koha gives the erroneous message "pickupNotInHoldGroup"

- Change your library to a something in Group 2
- Find a bib with only 1 item from Group 1. Confirm you cannot place a hold on this title for a patron in Group 1 (incorrect), and not for a patron in Group 2 (correct).
- Find a bib with only 1 item from Group 2. Confirm you cannot place a hold for a patron from Group 1 (correct), but you can place a hold for a patron from Group 2 (correct)
=> FAIL: Things expected to fail on the plan, fail.
2. Apply this patches
3. Repeat 1
=> SUCCESS: It now works!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit aa221e0c8bcf0fa0377d6c2154bad0ef61c97a2b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27071: More tests for Koha::Library->validate_hold_sibling
Tomas Cohen Arazi [Tue, 24 Nov 2020 14:55:14 +0000 (11:55 -0300)]
Bug 27071: More tests for Koha::Library->validate_hold_sibling

This patch adds tests for more than one non-same sibling libraries in
the hold group. Tests pass which means it is working as expected.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Libraries.t
=> SUCCESS: Tests pass

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1de7ec0697c75c3161d950b9f6f6c8d99640b607)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27071: Code simplification
Jonathan Druart [Mon, 23 Nov 2020 14:52:56 +0000 (15:52 +0100)]
Bug 27071: Code simplification

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c6606d4a6567a00f2defd72a32ff466c01a54e96)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27071: Fix Hold pickup library when using hold groups
Jonathan Druart [Mon, 23 Nov 2020 14:49:35 +0000 (15:49 +0100)]
Bug 27071: Fix Hold pickup library when using hold groups

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4b445425ebaffe4ec4aab3c45cb4ae4f2d4bf172)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26208: Perform batch checkin/renewals serially rather than asynchronously
Nick Clemens [Thu, 3 Dec 2020 19:13:15 +0000 (19:13 +0000)]
Bug 26208: Perform batch checkin/renewals serially rather than asynchronously

The issue here seems to be that when multiple requests hit at once they may not register that the renewal
performed by the request should lift restrictions on the account.

To mitigate this we can simply perform the renewals one after the other.

To test:
1 - have multiple overdue items on one patron
2 - run overdues.pl with triggers set to generate a restriction
3 - renew all overdues with the Renew All button
4 - restriction is not removed even though patron no longer has overdue items
5 - Apply patch
6 - Make all items overdue again
7 - Click Renew All
8 - Items are renewed and restriction removed
9 - Checkout items to patron again (overdue or not)
10 - Click 'Select all' in checkin column
11 - Click 'Renew/Checkin selected items'
12 - Confirm checkin succeeds as before patches

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26208: (follow-up) Remove debugging statements

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a825c729386e7f528846445937e00eda92f01f68)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27593: Consistent behavior for club holds route
Tomas Cohen Arazi [Tue, 2 Feb 2021 14:22:50 +0000 (11:22 -0300)]
Bug 27593: Consistent behavior for club holds route

This patch:
- Fixes a malformed response when biblio_id is invalid
- Fixes the return status (400 => 404) when biblio_id is invalid
- Adapts the error strings to be consistent with the Cities.pm file

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/clubs_holds.t
=> FAIL: Tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2387ac731c03ecfa6cd20e7e71037bbd3c3ac046)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27593: Regression tests
Tomas Cohen Arazi [Tue, 2 Feb 2021 14:18:27 +0000 (11:18 -0300)]
Bug 27593: Regression tests

This patch introduces tests for the behaviour change (400 => 404) and
also adds tests for untested (error) behaviours. Notably, the 'Biblio
not found' problematic return value couldn't be triggered, because the
OpenAPI plugin returns a 500 because the response was malformed
(expected { error => 'message' } and it was returning a string).

For the above reason, running the regression tests will show a 500...
instead of the expected 400.

I covered the rest of the codepaths that trigger errors to have full
coverage.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/clubs_holds.t
=> FAIL: Tests fail loudly

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 024a32ca807bb69b3d46136421dce871ba0bddbf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27713: Duplicate search field IDs in MARC framework administration template
Owen Leonard [Tue, 16 Feb 2021 13:48:04 +0000 (13:48 +0000)]
Bug 27713: Duplicate search field IDs in MARC framework administration template

This patch makes a minor change to the MARC framework administration
template so that the ID of a form field on the page isn't a duplicate of
one in the header search form.

To test, apply the patch and go to Administration -> MARC bibliographic
framework -> MARC structure.

- Test the "Search for tag" form field to confirm that it works
  correctly.
- Validate the HTML of the page to confirm that there are no "Duplicate
  ID" errors.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ebb70e4d16df961698e379c8208984809ad340be)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27332: Hide branchcode and note is RenewSerialAddsSuggestion if off
Jonathan Druart [Tue, 5 Jan 2021 08:54:54 +0000 (09:54 +0100)]
Bug 27332: Hide branchcode and note is RenewSerialAddsSuggestion if off

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d0182ab805b436f346637cae196e851371005552)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27332: Use the branchcode from the subscription when renewing
Jonathan Druart [Tue, 5 Jan 2021 07:10:33 +0000 (08:10 +0100)]
Bug 27332: Use the branchcode from the subscription when renewing

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 6aa9f78258444a5db6ba9997491865f13ff96404)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27661: Compiled CSS
Fridolin Somers [Thu, 25 Feb 2021 09:46:07 +0000 (10:46 +0100)]
Bug 27661: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27661: Use td.bg-success for ES and memcached as well
Jonathan Druart [Fri, 19 Feb 2021 07:57:25 +0000 (08:57 +0100)]
Bug 27661: Use td.bg-success for ES and memcached as well

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 2029b7ef8b414c207bc703e769b7e3721e9488b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27661: (QA follow-up) Use bootstrap classes
Martin Renvoize [Thu, 18 Feb 2021 16:56:21 +0000 (16:56 +0000)]
Bug 27661: (QA follow-up) Use bootstrap classes

This patch removes the local status_* css rules in favour of using the
bg-* rules that are shipped with the bootstrap version we are using and
then updates the relevant lines in the template to use those classes.

We also update the default table styling which adds background color to
the odd table rows so that our local classes take precidence.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit ab23dfa3a14fd7d1ecdd78d755476f8afcd69efa)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27661: (QA follow-up) Capitalization
Katrin Fischer [Fri, 12 Feb 2021 15:41:24 +0000 (15:41 +0000)]
Bug 27661: (QA follow-up) Capitalization

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fdd6f94844139fd54d82dabf1c0d571def47c10e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27661: Update about for message broker status
Martin Renvoize [Tue, 9 Feb 2021 13:53:55 +0000 (13:53 +0000)]
Bug 27661: Update about for message broker status

This patch updates the about page with regards to the message broker
status and adds some small formatting improvements for displaying the
status.

Test plan
1/ Run through the yarn build process to update the CSS file.
2/ View the about page without RabbitMQ installed
3/ View the about page with RabbitMQ installed
4/ Note the formatting and message change and signoff

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 7ed120dfb587e7c82ebda391abbfe9806d15dc81)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27729: Fix use of grep and split in CheckReserves
Marcel de Rooy [Fri, 19 Feb 2021 10:17:26 +0000 (10:17 +0000)]
Bug 27729: Fix use of grep and split in CheckReserves

A few lines of code were added to CheckReserves containing the wrong
use of two perl functions: grep and split on bug 25232.
A test was added even making these things pass.

Test plan:
Run t/db../Holds.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c4c3d1e93c337d93679e50f2354c8b060e50bcd9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27014: (QA follow-up) Add regression tests
Martin Renvoize [Tue, 12 Jan 2021 11:15:28 +0000 (11:15 +0000)]
Bug 27014: (QA follow-up) Add regression tests

This patch adds a regression test for the change introduced in the
patchset.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit d9c6365793de79730210429d1689300881181277)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27014: Enable C4::SIP::ILS::Patron::new to accept a hash
Kyle M Hall [Fri, 13 Nov 2020 13:24:43 +0000 (08:24 -0500)]
Bug 27014: Enable C4::SIP::ILS::Patron::new to accept a hash

Caused by bug 23403 - when performing a checkin we lookup the SIP patron
using the borrowernumber, however, SIP only knows how to find a patron
via cardnumber or userid

The change on 23403 was to avoid using an 'id' that didn't always exist
(as some users don't have a userid or cardnumber

When checking in, however, we are not passed a user cardnumber or
borrowernumber, so we don't have those on hand to get the patron.

Test Plan:
1) Check in an item via SIP, note patron is not found
2) Apply this patch
3) Restart all the things!
4) Check in an item via SIP, patron should be found!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 05e16389efa6e66476484ee12c3a5c5fdd48757b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27714: Prevent Koha::NewsItem->author to explode
Jonathan Druart [Wed, 17 Feb 2021 11:03:56 +0000 (12:03 +0100)]
Bug 27714: Prevent Koha::NewsItem->author to explode

If the author of a news has been removed, Koha::NewsItem->author must
not explode

DBIC result _type  isn't of the _type Borrower at t/db_dependent/Koha/News.t line 68.

Test plan:
 prove t/db_dependent/Koha/News.t
must return green, and changes must be consistent

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 506b8f125b7c7dda1dc70b4963026ea975a8c655)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 23675: Add leader and default value for ACQ
Jonathan Druart [Mon, 8 Feb 2021 10:52:17 +0000 (11:52 +0100)]
Bug 23675: Add leader and default value for ACQ

When UseACQFrameworkForBiblioRecords is set, the ACQ framework will be
use when ordering.
But the leader is not defined for this framework and then we will face
encoding issues (I haven't go far investigating this as the suggested
solution worked correctly).

The idea is to define a 000 and default to '     nam a22     7a 4500'
(which is what returns the marc21_leader.pl plugin) for ACQ.

Test plan:
0. Apply this patch and reset_all
1. Create a new basket and place a new order
2. Note that the leader is now displayed on top of the other ACQ
subfields
3. Fill in 245 with "❤️", "ö" or other UTF-8 characters you like
4. Save
5. Notice that 245$a in biblio_metadata is correctly filled with the
title you entered

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a6527b105897e4611dd702ffbe627ca579baff77)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26051: We should sort callnumber based on cn-sort
Nick Clemens [Fri, 8 Jan 2021 13:14:42 +0000 (13:14 +0000)]
Bug 26051: We should sort callnumber based on cn-sort

In zebra we sort by callnumber using 8007 cn-sort

We should do the same in elasticsearch

To test:
1 - Have Koha using Elasticsearch
2 - Perform a search
3 - Attempt to sort by callnumber
4 - Error in logs: No mapping found for [local-classification__sort]
5 - Apply patch
6 - Restart all
7 - Perform a search and sort by callnumber
8 - Success!

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a52a0f80b890d70bb51c8629afbf4d81c2901491)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 26051: Add sort=1 on cn-sort in mappings.yaml
Fridolin Somers [Fri, 22 Jan 2021 08:02:11 +0000 (09:02 +0100)]
Bug 26051: Add sort=1 on cn-sort in mappings.yaml

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 8790fe908d0207f1923aaad87dc48eecb5747d40)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 23929: Invoice adjustments should filter inactive funds
Blou [Tue, 26 Jan 2021 20:36:31 +0000 (15:36 -0500)]
Bug 23929: Invoice adjustments should filter inactive funds

Looking at invoice details, this makes the Adjustments Fund dropdown act
exactly like the Shipping Fund dropdown above, with a Show inactive
checkbox to help filter (by default) the inactive funds out of the list.

Test plan:
0) requires a database with inactive (old) funds along with active ones.
1) Go to invoice details page
2) Click "Add adjustment"
3) Open the drop down beside the Fund label, you should see EVERY fund in database.
4) Compare with behavior of Shipping fund dropdown above.  Not every fund is listed there
5) Apply patch
6) Now behavior is the same, only active fund are listed by default.
7) click "Show inactive" checkbox and see all the funds in the dropdown.

Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit bdfb78a69a1f78488b800bd38392c60812717cc7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistration...
Jonathan Druart [Thu, 4 Feb 2021 16:37:26 +0000 (17:37 +0100)]
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail

If categorycode is selected in
PatronSelfRegistrationBorrowerUnwantedField and
PatronSelfRegistrationVerifyByEmail is turned on, the patron self registration
fails with

   [You must provide a patron's category to validate password's strength
   and length] at /usr/share/perl5/Exception/Class/Base.pm line 88

Test plan:
0. Select categorycode in PatronSelfRegistrationBorrowerUnwantedField
   and turn on PatronSelfRegistrationVerifyByEmail
1. Self register a patron
2. Confirm that it works as expected with this patch applied.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 74ae74d5faec9a4ba4fbf573b4a81b1274402773)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
3 years agoBug 27534: Add missing ON UPDATE/DELETE clause to message_transport_type_fk
Jonathan Druart [Wed, 27 Jan 2021 08:43:02 +0000 (09:43 +0100)]
Bug 27534: Add missing ON UPDATE/DELETE clause to message_transport_type_fk

Bug 9016 (3.15.00.039) added message_transport_type_fk but the ON DELETE
CASCADE ON UPDATE CASCADE clause was missing from the updatedatabase
entry.
If we are upgrading from an old version, 20.06.00.058 will fail on
updating the message_transport_type, with
"Cannot delete or update a parent row: a foreign key constraint fails".

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 57a15eb474b5a8a6a199df1d324c30b7df0544d7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>