]> git.koha-community.org Git - koha.git/log
koha.git
2 years agoBug 29319: Use Business::ISBN to check ISBNs on addbooks.pl/cataloging search
Lucas Gass [Mon, 25 Oct 2021 22:52:22 +0000 (22:52 +0000)]
Bug 29319: Use Business::ISBN to check ISBNs on addbooks.pl/cataloging search

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 14c8d4c230ff96932ab87099f7594f311ffc4562)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: (follow-up) Fix code that I copied from too
Nick Clemens [Thu, 21 Oct 2021 10:31:18 +0000 (10:31 +0000)]
Bug 29284: (follow-up) Fix code that I copied from too

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit c32cca53bdfe07a3ee27ebac36c7aae3d51c68d9)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: (follow-up) Improve error logging to prevent warns
Nick Clemens [Thu, 21 Oct 2021 10:26:12 +0000 (10:26 +0000)]
Bug 29284: (follow-up) Improve error logging to prevent warns

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit cf29caf39fed2d81262735fe7893a1ac3a8d59b1)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: Unit test
Nick Clemens [Thu, 21 Oct 2021 10:08:05 +0000 (10:08 +0000)]
Bug 29284: Unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit fa56c8b069b3d8e3aa4651d39e98db5f45883de8)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: Handle the case of an exclamation point in parentheses
Nick Clemens [Wed, 20 Oct 2021 12:49:42 +0000 (12:49 +0000)]
Bug 29284: Handle the case of an exclamation point in parentheses

This expands the regex to handle this specific case

To test:
1 - Load record created for last patch
2 - Note analytics error
3 - Apply patch
4 - Restart and reload
5 - No more errorm also no Analytics link
6 - Add a 773$t to a record with title used before:
    Digger does it all (not really!)
7 - reload the initial record
8 - See 'Show analytics' link
9 - Click the link
10 - You should end up on the record you added the 773 to

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7c74eb91248cbdc383e5b3d0d1c48c4ae5d570a3)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: Don't die on analytics searching error
Nick Clemens [Wed, 20 Oct 2021 12:46:07 +0000 (12:46 +0000)]
Bug 29284: Don't die on analytics searching error

This patch adds an eval around the call to search for analytic records
It pases a value to the template on the staff side, but logs the warning on
the opac

This seems similar to 'decoding_error' which is noted on staff side, but absent on OPAC

The eval follows the patter used during searching

To test:
1 - Add a title to catalog, with 245a:
    Digger does it all (not really!)
2 - Set searchEngine preference to: Elasticsearch
3 - The record does not load
4 - Apply patch
5 - The record loads, there is a note about analytics at the top fo the record
6 - View record in opac, no note
7 - Check logs on intranet and opac, searching error is logged

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ab13f33eaee2599beb376366524d92afa79df034)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: (QA follow-up) Make clean_search_term public
Martin Renvoize [Wed, 1 Sep 2021 14:58:04 +0000 (15:58 +0100)]
Bug 28316: (QA follow-up) Make clean_search_term public

With all the work that's gone into improving the internal
_clean_search_term method I feel we should expose it publically as it's
going to be more widely helpful

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 641e8e4096b8d55afb534d593743154807f77221)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: escape ES ranges if QueryAutoTruncate is enabled
Petro Vashchuk [Mon, 6 Sep 2021 13:46:45 +0000 (16:46 +0300)]
Bug 28316: escape ES ranges if QueryAutoTruncate is enabled

if QueryAutoTruncate enabled we will have any special operators ruined
for example: "test [6 TO 7]" will be converted to "test* [6* TO* 7]"
so no reason to keep ranges when QueryAutoTruncate set to "enabled"

1) enable QueryAutoTruncate at your sysprefs.
2) perform a search using range, for example: "[1999 TO 2020]",
it shouldn't work the way it's supposed to.
3) apply the patch.
4) perform the same search with range, ensure that it works correctly.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e84759dfee9a4323a17146b88aba9d717ca0bb75)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: avoid messing up regexes in the search queries
Petro Vashchuk [Mon, 14 Jun 2021 13:38:51 +0000 (16:38 +0300)]
Bug 28316: avoid messing up regexes in the search queries

This patch ensures that the behavior with
QueryRegexEscapeOptions set to values other than
"Escape" still will works as expected.

It does so by storing the contents of regexes
before escaping special characters and
then restores the contents of regexes back to how
it was before, ensuring that searching with regex is possible.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 59c26ce5f35f3f18830090b048d0cd6c2a1eb6fc)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: escape exclamation signs in the query
Petro Vashchuk [Fri, 18 Jun 2021 07:44:56 +0000 (10:44 +0300)]
Bug 28316: escape exclamation signs in the query

Currently having exclamation sign at the end of the query makes ES
search fail, and when you try to search for a book that has exclamation
sign in the tittle (something like "Words! words") won't show results
correctly as it tries to negate everything that is after exclamation
sign, making it impossible to search for books that have in in the title

This patch escapes exclamation signs if it's at the end of the query or
has a space after it, resolving both of the issues listed above.

To reproduce:
1) with ES enabled, search for the book with title that contains
exclamation sight at the end, like "book!", this search should result
 in error.
2) do another search, but this time find/prepare beforehand book with a
title that has exclamation sign with a space after it,
e.g "exclamation! sign", it shouldn't find it as ES treats everything
after that exclamation sign as negation.
2) apply the patch.
3) perform searches from the steep one and two again.
Search from step one should no longer fail, while search from the step
two should find that book.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit cb156ac13224f03db8ce0bd1373335b7d4052437)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: escape brackets in the search query
Petro Vashchuk [Tue, 13 Jul 2021 09:13:03 +0000 (12:13 +0300)]
Bug 28316: escape brackets in the search query

This patch screens square and curly brackets which have no special
language meaning.

To reproduce:
1) using ES, search for the book with title that contains
square and/or curly brackets, like "book [second edition]", which will
result in error.
2) apply the patch.
3) search for that book again, ensure that it works now.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 952b5a6a469460e926905d6582688dd903988aad)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: screen unquoted semicolons and all followup colons
Petro Vashchuk [Fri, 18 Jun 2021 07:43:14 +0000 (10:43 +0300)]
Bug 28316: screen unquoted semicolons and all followup colons

Currently searches like: "book:", ":book" and "host-item:test:n"
cause internal server errors.

This patch adds additional regexes that remove the colons at the start
and end of the query, and another regex that screens all follow-up
colons that go after the first colon to avoid errors when searching for
"host-item:test:n".

To reproduce:
1) using ES, search for the book with title that contains
semicolon at the start or at the end of the line, separated with spaces,
this should cause internal server error.
2) try doing the same with something like "host-item:test:n", it should
result in error as well.
3) apply the patch.
4) repeat steps 1-2, ensure that it works now.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 5b4b14e493fef9f8f84060b6b5d83fbdcccfc65e)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: add tests
Petro Vashchuk [Tue, 15 Jun 2021 07:40:27 +0000 (10:40 +0300)]
Bug 28316: add tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 405812b407f77de2d60c8f4534728399068789d8)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoUpdate release notes for 20.11.13 release v20.11.13
Victor Grousset/tuxayo [Fri, 24 Dec 2021 14:50:17 +0000 (15:50 +0100)]
Update release notes for 20.11.13 release

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoIncrement version for 20.11.13 release
Victor Grousset/tuxayo [Thu, 23 Dec 2021 22:08:42 +0000 (23:08 +0100)]
Increment version for 20.11.13 release

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoFix translations for Koha 20.11.13
Victor Grousset/tuxayo [Thu, 23 Dec 2021 22:06:09 +0000 (23:06 +0100)]
Fix translations for Koha 20.11.13

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoTranslation updates for Koha 20.11.13
Koha translators [Thu, 23 Dec 2021 00:31:50 +0000 (21:31 -0300)]
Translation updates for Koha 20.11.13

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 27801: Fix javascript price calculations
Martin Renvoize [Fri, 3 Dec 2021 15:29:00 +0000 (15:29 +0000)]
Bug 27801: Fix javascript price calculations

This patch ensures we're formatting the price values consistently for
the table total and the amount to pay input field.

Test plan
1) Add an item to charge at 0.10.
2) Add this same item 8 or 9 times (Do not use the 'quantity')
3) Note that the table total and the 'Amount paid' values do not match
4) Apply the patch and repeat the above steps.. the values should now
   match.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7e72a7dde5a73ed6177b321d29fca0df13f08f2c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 9e16f33b37aaf107ff3293df0cd3da5f94563c81)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: REVERT ALL: due to string freeze
Victor Grousset/tuxayo [Wed, 22 Dec 2021 19:47:24 +0000 (20:47 +0100)]
Bug 28316: REVERT ALL: due to string freeze

The follow-up bug 29284 introduces a new string.
Both patchsets will be backported for next release.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: REVERT ALL: due to string freeze
Victor Grousset/tuxayo [Wed, 22 Dec 2021 19:45:35 +0000 (20:45 +0100)]
Bug 29284: REVERT ALL: due to string freeze

Will be backported for next release

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: (follow-up) Fix code that I copied from too
Nick Clemens [Thu, 21 Oct 2021 10:31:18 +0000 (10:31 +0000)]
Bug 29284: (follow-up) Fix code that I copied from too

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit c32cca53bdfe07a3ee27ebac36c7aae3d51c68d9)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: (follow-up) Improve error logging to prevent warns
Nick Clemens [Thu, 21 Oct 2021 10:26:12 +0000 (10:26 +0000)]
Bug 29284: (follow-up) Improve error logging to prevent warns

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit cf29caf39fed2d81262735fe7893a1ac3a8d59b1)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: Handle the case of an exclamation point in parentheses
Nick Clemens [Wed, 20 Oct 2021 12:49:42 +0000 (12:49 +0000)]
Bug 29284: Handle the case of an exclamation point in parentheses

This expands the regex to handle this specific case

To test:
1 - Load record created for last patch
2 - Note analytics error
3 - Apply patch
4 - Restart and reload
5 - No more errorm also no Analytics link
6 - Add a 773$t to a record with title used before:
    Digger does it all (not really!)
7 - reload the initial record
8 - See 'Show analytics' link
9 - Click the link
10 - You should end up on the record you added the 773 to

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 7c74eb91248cbdc383e5b3d0d1c48c4ae5d570a3)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: Unit test
Nick Clemens [Thu, 21 Oct 2021 10:08:05 +0000 (10:08 +0000)]
Bug 29284: Unit test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit fa56c8b069b3d8e3aa4651d39e98db5f45883de8)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29284: Don't die on analytics searching error
Nick Clemens [Wed, 20 Oct 2021 12:46:07 +0000 (12:46 +0000)]
Bug 29284: Don't die on analytics searching error

This patch adds an eval around the call to search for analytic records
It pases a value to the template on the staff side, but logs the warning on
the opac

This seems similar to 'decoding_error' which is noted on staff side, but absent on OPAC

The eval follows the patter used during searching

To test:
1 - Add a title to catalog, with 245a:
    Digger does it all (not really!)
2 - Set searchEngine preference to: Elasticsearch
3 - The record does not load
4 - Apply patch
5 - The record loads, there is a note about analytics at the top fo the record
6 - View record in opac, no note
7 - Check logs on intranet and opac, searching error is logged

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ab13f33eaee2599beb376366524d92afa79df034)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: (QA follow-up) Make clean_search_term public
Martin Renvoize [Wed, 1 Sep 2021 14:58:04 +0000 (15:58 +0100)]
Bug 28316: (QA follow-up) Make clean_search_term public

With all the work that's gone into improving the internal
_clean_search_term method I feel we should expose it publically as it's
going to be more widely helpful

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 641e8e4096b8d55afb534d593743154807f77221)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: escape ES ranges if QueryAutoTruncate is enabled
Petro Vashchuk [Mon, 6 Sep 2021 13:46:45 +0000 (16:46 +0300)]
Bug 28316: escape ES ranges if QueryAutoTruncate is enabled

if QueryAutoTruncate enabled we will have any special operators ruined
for example: "test [6 TO 7]" will be converted to "test* [6* TO* 7]"
so no reason to keep ranges when QueryAutoTruncate set to "enabled"

1) enable QueryAutoTruncate at your sysprefs.
2) perform a search using range, for example: "[1999 TO 2020]",
it shouldn't work the way it's supposed to.
3) apply the patch.
4) perform the same search with range, ensure that it works correctly.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e84759dfee9a4323a17146b88aba9d717ca0bb75)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: avoid messing up regexes in the search queries
Petro Vashchuk [Mon, 14 Jun 2021 13:38:51 +0000 (16:38 +0300)]
Bug 28316: avoid messing up regexes in the search queries

This patch ensures that the behavior with
QueryRegexEscapeOptions set to values other than
"Escape" still will works as expected.

It does so by storing the contents of regexes
before escaping special characters and
then restores the contents of regexes back to how
it was before, ensuring that searching with regex is possible.

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 59c26ce5f35f3f18830090b048d0cd6c2a1eb6fc)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: escape exclamation signs in the query
Petro Vashchuk [Fri, 18 Jun 2021 07:44:56 +0000 (10:44 +0300)]
Bug 28316: escape exclamation signs in the query

Currently having exclamation sign at the end of the query makes ES
search fail, and when you try to search for a book that has exclamation
sign in the tittle (something like "Words! words") won't show results
correctly as it tries to negate everything that is after exclamation
sign, making it impossible to search for books that have in in the title

This patch escapes exclamation signs if it's at the end of the query or
has a space after it, resolving both of the issues listed above.

To reproduce:
1) with ES enabled, search for the book with title that contains
exclamation sight at the end, like "book!", this search should result
 in error.
2) do another search, but this time find/prepare beforehand book with a
title that has exclamation sign with a space after it,
e.g "exclamation! sign", it shouldn't find it as ES treats everything
after that exclamation sign as negation.
2) apply the patch.
3) perform searches from the steep one and two again.
Search from step one should no longer fail, while search from the step
two should find that book.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit cb156ac13224f03db8ce0bd1373335b7d4052437)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: escape brackets in the search query
Petro Vashchuk [Tue, 13 Jul 2021 09:13:03 +0000 (12:13 +0300)]
Bug 28316: escape brackets in the search query

This patch screens square and curly brackets which have no special
language meaning.

To reproduce:
1) using ES, search for the book with title that contains
square and/or curly brackets, like "book [second edition]", which will
result in error.
2) apply the patch.
3) search for that book again, ensure that it works now.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 952b5a6a469460e926905d6582688dd903988aad)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: screen unquoted semicolons and all followup colons
Petro Vashchuk [Fri, 18 Jun 2021 07:43:14 +0000 (10:43 +0300)]
Bug 28316: screen unquoted semicolons and all followup colons

Currently searches like: "book:", ":book" and "host-item:test:n"
cause internal server errors.

This patch adds additional regexes that remove the colons at the start
and end of the query, and another regex that screens all follow-up
colons that go after the first colon to avoid errors when searching for
"host-item:test:n".

To reproduce:
1) using ES, search for the book with title that contains
semicolon at the start or at the end of the line, separated with spaces,
this should cause internal server error.
2) try doing the same with something like "host-item:test:n", it should
result in error as well.
3) apply the patch.
4) repeat steps 1-2, ensure that it works now.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 5b4b14e493fef9f8f84060b6b5d83fbdcccfc65e)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 28316: add tests
Petro Vashchuk [Tue, 15 Jun 2021 07:40:27 +0000 (10:40 +0300)]
Bug 28316: add tests

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 405812b407f77de2d60c8f4534728399068789d8)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug ?????: Compile SCSS, forgotten in a previous release cycle
Victor Grousset/tuxayo [Wed, 22 Dec 2021 16:45:11 +0000 (17:45 +0100)]
Bug ?????: Compile SCSS, forgotten in a previous release cycle

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29330: (QA follow-up) Change to message/rfc822
Marcel de Rooy [Fri, 12 Nov 2021 08:55:42 +0000 (08:55 +0000)]
Bug 29330: (QA follow-up) Change to message/rfc822

This content-type might be more appropriated to use as a temporary
label for the serialized email message with attachments.

WARNING: perl -cw tells you that the constant is redefined. This has
to do with an already existing module dependency loop of Letters.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 53127abc0377bc3f04364c4183baacef3d4c95c4)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29330: (QA follow-up) Use passed MIME type
Tomas Cohen Arazi [Mon, 8 Nov 2021 11:10:38 +0000 (08:10 -0300)]
Bug 29330: (QA follow-up) Use passed MIME type

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: tidied.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 6c961026789ef1dfdd3ebd4ed18469fef7bd649b)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29330: Restore handling of serialized MIME messages in message_queue
Tomas Cohen Arazi [Fri, 5 Nov 2021 19:05:48 +0000 (16:05 -0300)]
Bug 29330: Restore handling of serialized MIME messages in message_queue

This patch changes how multipart MIME messages are handled on the
message_queue table.

The email, with the required attachments, is now generated using
Koha::Email, and serialized using Koha::Email->as_string.

This bug also adds Koha::Email->new_from_string which is used to read
that data from the DB, and produce a Koha::Email object, that can be
further augmented/modified using regular Koha::Email methods.

This implementation should be considered a middle ground, with
backportability in mind. higher-level methods should encapsulate setting
the default headers and addresses, to clean the area a bit further.

Preparation:
- You need a valid SMTP configuration in koha-conf.xml. If you use Gmail
  you can generate an 'app password' and set things like this:

 <smtp_server>
    <host>smtp.gmail.com</host>
    <port>587</port>
    <timeout>5</timeout>
    <ssl_mode>STARTTLS</ssl_mode>
    <user_name>youraddress@gmail.com</user_name>
    <password>youpassword</password>
    <debug>1</debug>
 </smtp_server>
- Set KohaAdminAddress to your address.

To test:
1. Pick a patron. Make sure it doesn't have any email address (Acevedo?)
2. Set an overdue notice trigger for its category
3. Check something out, with due date in the past to force an overdue
4. Run:
   $ kshell
  k$ misc/cronjobs/overdue_notices.pl -v
  k$ exit
   $ koha-mysql kohadev
   > SELECT * FROM message_queue WHERE borrowernumber=the_borrowernumber;
=> SUCCESS: A notice has been created
5. Run:
   $ kshell
  k$ misc/cronjobs/process_message_queue.pl --verbose
=> SUCCESS: SMTP is ok => Email is sent
=> FAIL: Your inbox shows an email with weird content
6. Apply this patches
7. Run:
   $ koha-mysql kohadev
   > DELETE FROM message_queue;
8. Repeat 4 and 5
=> SUCCESS: You got an email with an attachment!
=> SUCCESS: The attachment contains an email that couldn't be delivered!
9. Try all the things that enqueue messages :-D
=> SUCCESS: No behavior change
10. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Edited the POD, restoring a few lines that describe the needed hash
keys of the attachments.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 54546da3f07380375470bc130f15a33830419ac8)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoBug 29330: Add Koha::Email->new_from_string
Tomas Cohen Arazi [Fri, 5 Nov 2021 18:22:25 +0000 (15:22 -0300)]
Bug 29330: Add Koha::Email->new_from_string

This patch introduces a new method to Koha::Email. This method allows us
to parse a MIME email to initialize the Koha::Email object. This is
particularly important when we are restoring emails from the DB. i.e.
from the *message_queue* table.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/Koha/Email.t
=> SUCCESS: Tests pass! Koha::Email->new_from_string is the correct
counterpart for Koha::Email->as_string!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 2d6a189e89cc81eff50cdd3a71f7eacc34287b3a)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
2 years agoUpdate release notes for 20.11.12 release v20.11.12
Fridolin Somers [Tue, 30 Nov 2021 06:55:41 +0000 (20:55 -1000)]
Update release notes for 20.11.12 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoIncrement version for 20.11.12 release
Fridolin Somers [Tue, 30 Nov 2021 06:47:14 +0000 (20:47 -1000)]
Increment version for 20.11.12 release

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoFix translations for Koha 20.11.12
Victor Grousset/tuxayo [Fri, 23 Jul 2021 02:54:44 +0000 (04:54 +0200)]
Fix translations for Koha 20.11.12

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoMerge remote-tracking branch 'translate/20.11.12-translate-20211130' into 20.11.x
Fridolin Somers [Tue, 30 Nov 2021 06:28:53 +0000 (20:28 -1000)]
Merge remote-tracking branch 'translate/20.11.12-translate-20211130' into 20.11.x

2 years agoTranslation updates for Koha 20.11.12
Koha translators [Tue, 30 Nov 2021 06:20:10 +0000 (03:20 -0300)]
Translation updates for Koha 20.11.12

2 years agoBug 29564: Use List::MoreUtils so SIP U16/Xenial does not break
Mason James [Wed, 24 Nov 2021 01:57:51 +0000 (14:57 +1300)]
Bug 29564: Use List::MoreUtils so SIP U16/Xenial does not break

 - run prove t/00-load.t, see error
 - apply patch

    00:07:08.189 koha_1       | #   Failed test 'use C4::SIP::Sip::Configuration;'
    00:07:08.189 koha_1       | #   at t/00-load.t line 46.
    00:07:08.189 koha_1       | #     Tried to use 'C4::SIP::Sip::Configuration'.
    00:07:08.189 koha_1       | #     Error:  "uniq" is not exported by the List::Util module

 - run prove t/00-load.t, see tests pass :0)

https://bugs.koha-community.org/show_bug.cgi?id=29478

https://bugs.koha-community.org/show_bug.cgi?id=29564

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit fb2e8e3450963aa3bdfee4fa1ddd9837e4224732)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29524: (bug 28935 follow-up) Restore modification of some patron's attributes
Jonathan Druart [Mon, 22 Nov 2021 13:24:40 +0000 (14:24 +0100)]
Bug 29524: (bug 28935 follow-up) Restore modification of some patron's attributes

On
  commit 5f37d8d2f496ce3c9fd6dfd5a2efa7a9fe435af3
  Bug 28935: No filtering on patron's data on member entry pages
we restricted the list of the columns from the borrowers table that can
be modified from the patron edit view.
We were too restrictive, the following 3 attributes can be edited from
this form: privacy_guarantor_fines, privacy_guarantor_checkouts,
checkprevcheckout and lang

Test plan:
Turn on the following prefs:
- AllowStaffToSetFinesVisibilityForGuarantor
- AllowStaffToSetCheckoutsVisibilityForGuarantor
- CheckPrevCheckout (set to 'unless overridden *')
- TranslateNotices
Edit a patron and see the 4 different options are now displayed.
Change their value, save, edit again
Confirm that the values have been saved

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0ca1419b26be84f7670f60446e621cfd878f6580)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28803: (20.11.x) Add invalid email handling in _send_message_by_email
Didier Gautheron [Fri, 24 Sep 2021 14:42:38 +0000 (16:42 +0200)]
Bug 28803: (20.11.x) Add invalid email handling in _send_message_by_email

Quickfix version for 20.11.x because of missing dependancies.
Based on Bug 28996.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28803: Add unit tests
Martin Renvoize [Thu, 5 Aug 2021 07:43:32 +0000 (08:43 +0100)]
Bug 28803: Add unit tests

This patch updates Letters.t to confirm that invalid email addresses in
the message_queue should not throw an exception when sending mail but
instead set the status to failed and pass error details to the end user.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years ago28870: (20.11.x) fix UT on SendQueuedMessages
Fridolin Somers [Thu, 25 Nov 2021 00:50:53 +0000 (14:50 -1000)]
28870: (20.11.x) fix UT on SendQueuedMessages

Taken from Bug 28803 :
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=125345&action=diff#a/t/db_dependent/Letters.t_sec1

2 years agoBug 29341: DBIC schema changes
Fridolin Somers [Sat, 20 Nov 2021 02:01:46 +0000 (16:01 -1000)]
Bug 29341: DBIC schema changes

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29341: DBRev 20.11.11.002
Kyle Hall [Fri, 19 Nov 2021 16:52:54 +0000 (11:52 -0500)]
Bug 29341: DBRev 20.11.11.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit c2430c6ee0d90753bc55700e01f159ec259f7b0d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29341: Remove foreign keys on pseudonymized_transactions
Jonathan Druart [Wed, 17 Nov 2021 11:25:35 +0000 (12:25 +0100)]
Bug 29341: Remove foreign keys on pseudonymized_transactions

Behave like the statistics table and don't remove the code even if the
branch or patron's category is removed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit f4c61260f537fad0aac5179b2a5ae25b56070703)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29405: Fix date_renewed attribute format in patron spec
Martin Renvoize [Wed, 3 Nov 2021 13:47:35 +0000 (13:47 +0000)]
Bug 29405: Fix date_renewed attribute format in patron spec

This patch just adds the 'date' format string to ensure we are
validating the input/output of the date_renewed field correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e165f57f248fbb5166834d5117caef4fddf3c3e3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29452: remove unnecessary warns in the logs
Christophe Croullebois [Wed, 10 Nov 2021 15:23:54 +0000 (16:23 +0100)]
Bug 29452: remove unnecessary warns in the logs

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8c8c7d77cfb220a7317739a4d84af48a466e569b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29321: Remove a last without loop context
Marcel de Rooy [Fri, 5 Nov 2021 15:00:04 +0000 (15:00 +0000)]
Bug 29321: Remove a last without loop context

This reads better when converted to regular if.
Note that last within such a block is allowed in Perl, but it feels
better to use it only in a loop context.

Test plan:
Read the patch ;)
Bonus: Test if you enter the block by using pref OPACSuggestionMandatoryFields
when adding a suggestion from opac.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: Added a space between 'if' and '(' :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 0144bb310ee207a7fde2091c8ada9c1ec11ecb50)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27145: Wrap delete and move_to_deleted in a transaction
Kyle M Hall [Fri, 4 Dec 2020 11:55:37 +0000 (06:55 -0500)]
Bug 27145: Wrap delete and move_to_deleted in a transaction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 90a4c9d878a523cbc161d302be7bb23e8d82cab5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27145: Rethrow all other exceptions
Kyle M Hall [Thu, 3 Dec 2020 14:10:30 +0000 (09:10 -0500)]
Bug 27145: Rethrow all other exceptions

Bug 14708 introduced a try catch around $patron->delete in commit:
  "Bug 14708: (QA follow-up) Use try/catch blocks when calling"

However, in the catch block it only assumes the exception was from trying to
delete anonymous patron when it can be anything else as well, the code should
be modified so that it will handle the anonymous patron case and if it is
anything else we log the other exception.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit df47a2e195e0d415e190b7bc5bc13504ec8be0c0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28627: Calculate unitprice if not set
Nick Clemens [Fri, 12 Nov 2021 17:15:20 +0000 (17:15 +0000)]
Bug 28627: Calculate unitprice if not set

On bug 23376 the developer was too clever by half. Instead of passing
values to the template we moved to simply passing the order object.

The calculations that populated the unitprice, however, were simply dropped.

This patch restores the behaviour of setting unitprice to the estimated cost
by default. We do this conditionally in the template

To test:
 1 - Create a basket and adding items to it. Set the 'Vendor price' to
    '20', do not add an 'Actual cost'
 2 - Close the basket
 3 - Select 'Receive shipment'
 4 - Set a value for vendor invoice
 5 - Receive the order you created
 6 - Observe 'Actual cost' is = 0.00
 7 - Apply patch
 8 - Refresh the order receival page, and confirm the 'Actual cost' =
    20.00
 9 - Cancel receipt - reopen basket - edit order - add an actual cost - close
10 - Receive the order again
11 - Confirm the actual price is used
12 - Repeat this whole plan, but ensure the vendor has a different value for
     Invoice prices: Include tax

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 4755db8a1dfc6fcf856d55369ea102b3571f1625)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29255: Built-in offline circulation broken with SQL error
Owen Leonard [Fri, 15 Oct 2021 18:27:16 +0000 (18:27 +0000)]
Bug 29255: Built-in offline circulation broken with SQL error

This patch makes a minor correction to one of the queries used when
synchronizing transactions in the built-in offline circulation system.
This fixes the error:

DBD::mysql::st execute failed: Column 'branchcode' in field list is
ambiguous at /kohadevbox/koha/offline_circ/download.pl line 84

To test you must be using a browser which still supports
applicationCache (Firefox before version 81, Chrome before version 94).

- Apply the patch and restart services.
- Enable the AllowOfflineCirculation system preference.
- Go to Circulation -> Built-in offline circulation interface.
- Click "Synchronize."
- Click the "Download records" button.
- After the page refreshes you should see updated dates where it lists
  "last synced" information.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 6501ff67ac1b7942f424bed458314efb0132bd68)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29264: SIP config allows use of non-branchcode institution ids causes workers...
Kyle M Hall [Mon, 18 Oct 2021 12:28:27 +0000 (12:28 +0000)]
Bug 29264: SIP config allows use of non-branchcode institution ids causes workers to die without responding

If is entirely possible to create an SIP institution whose ID does not match a valid branchcode in Koha's SIP config. In fact, Koha's example SIP config contains an example of this ( kohalibrary / kohalibrary2 ).

If a SIP login uses an institution with an id that doesn't match a valid branchcode, everything will appear to work, but the SIP worker will die anywhere that Koha gets the branch from the userenv and assumes it is valid.

The repercussions of this are that actions such as the checkout message simply die and do not return a response message to the requestor.

At the very least, we should output a warning to the SIP log.

I think we should strongly consider disallowing institution ids in the SIP config that do not match valid branchcodes. In this scenario, attempting to start the SIP server should result in a error message with the SIP server exiting immediately.

Test Plan:
1) Apply this patch
2) Make a sip login that uses an instution whose id is *not* a valid branchcode
3) Start the SIP server
4) Check sip.log, you should see a warning similar to the following:
[2021/10/18 12:18:29] [2068079] [ERROR] ERROR: Institution kohalibrary does does not match a branchcode. This can cause unexpected behavior. C4::SIP::Sip::siplog /kohadevbox/koha/C4/SIP/Sip.pm (220)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8e1f0cfc8dd71c507af83f9f8033ba9c84d0b293)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29204: (QA follow-up) Fix variable name
Joonas Kylmälä [Sat, 6 Nov 2021 14:16:38 +0000 (14:16 +0000)]
Bug 29204: (QA follow-up) Fix variable name

The patch "Bug 29204: Fix reports/issues_stats.pl for MySQL 8"
accidentally changed the variable name from $strsth2 to $strsth

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 5d2f51f9ad9ec5f46cc7a5ef2264ad9c5a188199)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29204: Fix reports/issues_stats.pl for MySQL 8
Jonathan Druart [Tue, 19 Oct 2021 09:08:29 +0000 (11:08 +0200)]
Bug 29204: Fix reports/issues_stats.pl for MySQL 8

Error was: Incorrect DATETIME value: ''

Test plan
Go to Reports -> Circulation
On Period select "Row" or "Column" and choose a date
Submit

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 9a4b7b1948ecba51c942bdbb6b202981a6cce144)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28870: non-FQDN addresses are valid
Jonathan Druart [Thu, 26 Aug 2021 15:21:32 +0000 (17:21 +0200)]
Bug 28870: non-FQDN addresses are valid

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8883409e0acd4f703d765389128c8dffe3ff9052)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28870: Use Email::Address->parse
Jonathan Druart [Thu, 26 Aug 2021 15:13:41 +0000 (17:13 +0200)]
Bug 28870: Use Email::Address->parse

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d35c9e5df7743382b023a732c584078d784767d2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28870: Move email address validation to a specific class method
Jonathan Druart [Thu, 26 Aug 2021 15:12:58 +0000 (17:12 +0200)]
Bug 28870: Move email address validation to a specific class method

To ease testing and future changes if needed.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 6d5a0bd832d546377910d3bdbb2bf790c4d2f0c3)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28870: Remove traces of Email::Valid
Tomas Cohen Arazi [Fri, 20 Aug 2021 21:37:37 +0000 (18:37 -0300)]
Bug 28870: Remove traces of Email::Valid

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 171c8421aa8c2838479789ab76b977e4fed10f9c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28870: Use Email::Address to validate email addresses
Tomas Cohen Arazi [Fri, 20 Aug 2021 21:23:30 +0000 (18:23 -0300)]
Bug 28870: Use Email::Address to validate email addresses

This patch adds a new dependency, Email::Address. It is used in
Koha::Email to replace the current use of Email::Valid, which proved to
be problematic when it comes to UTF-8 characters.

Email::Address provides suitable regexes that -when used- keep our
tests passing, but also deal better with UTF-8 data.

To test:
1. Apply the regression tests patch
2. Notice the only change is that it tweaks a couple addresses so they
   contain umlauts and also have the "Description <address>" format that
   is used when sending carts.
3. Run:
   $ kshell
  k$ prove t/Koha/Email.t
=> FAIL: Tests fail! Things die because Email::Valid doesn't like the
   from we passed.
4. Run:
   $ sudo apt install libemail-address-perl
5. Apply this patch
6. Repeat 3
=> SUCCESS: Tests pass!
7. Try what is described in comment 1
=> SUCCESS: Things are back to normal
8. Sign off :-D
9. Send cookies

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 5d612707f017899f8b2152985a4fafdadbd2159a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28870: Regression tests
Tomas Cohen Arazi [Fri, 20 Aug 2021 21:22:58 +0000 (18:22 -0300)]
Bug 28870: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e6ff06d263f5728c400dfb3de8f9704f06499a4c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29195: Compiled CSS
Fridolin Somers [Fri, 12 Nov 2021 23:20:34 +0000 (13:20 -1000)]
Bug 29195: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29195: Fix highlighting on odd rows in circ-patron-search-results
Owen [Fri, 5 Nov 2021 12:22:07 +0000 (12:22 +0000)]
Bug 29195: Fix highlighting on odd rows in circ-patron-search-results

This patch adds "!important" to the CSS rule governing the background
color of table cells when hovered. It only applies to tables with the
"selections-table" class.

Although "!important" is not usually recommended, in this case the
appliation is narrow enough that I think it outweighs the complicated
selector that would be required to make it work otherwise.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

- Locate a record in the catalog and being the process of placing a
  hold.
- When you're asked to enter a card number or search by name, search
  using a name which will return multiple results.
- In the table of results, hovering the mouse over the table should
  highlight the row in yellow.
- Perform the same test when searching for a club by name.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit fb650607032c851471610873a3065b60d2aaffca)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29416: (bug 28941 follow-up) Restore suggestion prefill
Jonathan Druart [Fri, 5 Nov 2021 09:13:47 +0000 (10:13 +0100)]
Bug 29416: (bug 28941 follow-up) Restore suggestion prefill

From commit 586bed1319592e05f5dc3acf64a1dba8cae69d6b
     Bug 28941: Filter suggestion inputs at the OPAC

But later in the script we send { suggestion => %$suggestion } to the
template and so erase the variable previously passed.

Test plan:
Login at the OPAC
Go to the bibliographic detail page
Suggest for purchase
=> The form must be prefilled!

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit fbd3d2d762cd2889d6207770ebe5f96f34b727c9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27708: (QA follow-up) Add a few tests for Koha::Edifact::Order
Joonas Kylmälä [Tue, 2 Nov 2021 23:22:45 +0000 (23:22 +0000)]
Bug 27708: (QA follow-up) Add a few tests for Koha::Edifact::Order

1. This adds a simple regression test to make sure order_line() method
executes correctly with basket create_items set to "ordering" and
"receiving".

2. A simple test for the filename method is added

To test:
 1) prove t/db_dependent/Koha/Edifact/Order.t

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8c1ea4ec8ab6509c67538b1bf78cdf9e44d60c96)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27708: Unify two item object creation blocks to be stored as hash
Petro Vashchuk [Wed, 3 Mar 2021 12:34:52 +0000 (14:34 +0200)]
Bug 27708: Unify two item object creation blocks to be stored as hash

Previously for existing item data was stored as an object reference and
then treated as one, but for not yet existing item data was stored as
keys in hash reference in the same variable and later it was treated
like an object, hence why it crashed with "no method".
This patch unifies that variable in both cases filled as hash and
treated as such.

To reproduce:
    1) Go to "Administration->System preferences" and change
"AcqCreateItem" to "receiving an order."
    2) Now, go to "Acquisitions" and create a new Vendor,
or use an existing one.
    3) Next, go to "Administration->EDI Account" and add EDI account
(pick that Vendor that you created recently, or the one that you will
use for this test).
    4) Also in "Administration->Library EANs" add EAN if you didn't
have one previously.
    5) Go back to "Acquisitions" and add a new basket to your Vendor
that you will use for this test.
    6) Press "Create EDIFACT order" button. It should throw
"Can't call method "homebranch" on unblessed reference..."
software error.
    7) Apply the patch.
    8) Reload the page that threw software error previously
(or repeat steps 5, 6 if you need another basket),
it should go through now.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e429519974bb7bd8125fa0194bb7a7a004c638ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28768: Fix borrowernumber from opac-readingrecord.tt
Jonathan Druart [Fri, 5 Nov 2021 08:30:31 +0000 (09:30 +0100)]
Bug 28768: Fix borrowernumber from opac-readingrecord.tt

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d5c7f3b3079f654dd1ec15da7f5300a6bd642a95)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28768: (QA follow-up) Remove unused variable
Nick Clemens [Fri, 30 Jul 2021 12:12:17 +0000 (12:12 +0000)]
Bug 28768: (QA follow-up) Remove unused variable

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 9f43e623c26386fbd3b7404a5cb2bef60bd5129b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28768: remove unnessesary template variable
Lucas Gass [Tue, 27 Jul 2021 18:08:12 +0000 (18:08 +0000)]
Bug 28768: remove unnessesary template variable

To test:
1. Add some news that should display on opac-readingrecord.pl. For example: opacheader, OpacCustomSearch, opaccredits
2. Go to opac-readingrecord.pl, the news doesn't display
3. Apply patch, restart_all
4. Go to opac-readingrecord.pl, the news displays
5. Turn on 'opacreadinghistory' and test to make sure it still works

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit df28bdd3517c5551401fb32d1fca9554e29a2e13)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29386: DBIC schema changes
Fridolin Somers [Fri, 12 Nov 2021 23:08:19 +0000 (13:08 -1000)]
Bug 29386: DBIC schema changes

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29386: DBRev 20.11.11.001
Kyle Hall [Thu, 11 Nov 2021 12:16:34 +0000 (07:16 -0500)]
Bug 29386: DBRev 20.11.11.001

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 78e28dc804d379f7409b553afe5851a8a4a7442b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29386: Extend background_jobs.data to LONGTEXT
Jonathan Druart [Thu, 4 Nov 2021 09:44:28 +0000 (10:44 +0100)]
Bug 29386: Extend background_jobs.data to LONGTEXT

TEXT is too small, we must extend it to allow bigger jobs.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d79599b7ecd384ae5b8beee12e80fb522b1e4583)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27173: Add tests
Marcel de Rooy [Tue, 28 Sep 2021 13:39:58 +0000 (13:39 +0000)]
Bug 27173: Add tests

Test plan:
Run t/db_dependent/Koha/Plugins/authority_hooks.t

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b0a570a856316b7fb34414239fdc559a33b0fe9f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27173: Add plugin hooks for authority record changes
Marcel de Rooy [Tue, 8 Dec 2020 14:54:00 +0000 (15:54 +0100)]
Bug 27173: Add plugin hooks for authority record changes

2021-09-28 Updated version

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 47555e6469ae6bf84388019d63205221b7398a03)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28474: Pass process_message_queue.pl params to before_send_messages plugin hooks
Kyle M Hall [Thu, 27 May 2021 13:53:01 +0000 (09:53 -0400)]
Bug 28474: Pass process_message_queue.pl params to before_send_messages plugin hooks

It would be useful to send most of the process_message_queue.pl script parameters to any plugin before_send_messages hooks. For example, the Twilio Voice plugin uses before_send_messages to send phone messages, but if the script is called with "-t email", it doesn't know and will make phone calls! If that info were passed in, the plugin could be made aware of it and only make calls if no "-t" or a "-t phone" were set in the parameters.

Test Plan:
1) Apply this patch
2) Install Kitchen Sink plugin v2.2.0 or later
   https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases/download/v2.2.0/dev-koha-plugin-kitchen-sink-2.2.0.kpz
3) Run misc/cronjobs/process_message_queue.pl with any or all non-email
   related paramters
4) Note the plugin output shows the parameters were passed to the plugin

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit f386c8ce85f5a8f0f0e42dd089b8226659e017a4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28973: Improve Koha::Patron::can_see_patron_infos efficiency
Kyle M Hall [Wed, 8 Sep 2021 12:31:47 +0000 (08:31 -0400)]
Bug 28973: Improve Koha::Patron::can_see_patron_infos efficiency

The method can_see_patron_infos looks up a row in the branches table by branchcode just to get the branchcode it already has. This seems inefficient.

Test Plan:
1) Apply this patch
2) No changes should be noted

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 616c12a1e4238e0ffea722f669cce404511b046b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28365: (Bug 19873 follow-up) Make it possible to search on value 0
Fridolin Somers [Mon, 17 May 2021 14:20:41 +0000 (16:20 +0200)]
Bug 28365: (Bug 19873 follow-up) Make it possible to search on value 0

Bug 19873 fixed search with value 0.
It works in first page but not in other pages.

This patch fixes query_cgi var.

Test plan:
  - create a st-numeric index in zebra conf related to
    a numeric field
    i.e:
    yourindex 1=yourindex 4=109
  - fill a field with 0 in several biblio records,
  - reindex your biblios,
  - search yourindex=0 and go to second page of results,
  - should not work,
  - apply this patch,
  - test again,
  - should work

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 14475990626dd16f82b08415b07cf8669ce51a54)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28365: Add unit test
Fridolin Somers [Mon, 17 May 2021 14:15:19 +0000 (16:15 +0200)]
Bug 28365: Add unit test

Run prove t/db_dependent/Search.t

Without fix you get error :
    #   Failed test 'buildQuery should keep 0 value in query_cgi'
    #   at t/db_dependent/Search.t line 670.
    #          got: 'idx=su%2Cphr'
    #     expected: 'idx=su%2Cphr&q=0'

This patch also adds a test for query_desc in case it is broken in the
future.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ae66b6f1753f15bee277d0467e7a36f1eb67c318)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28729: Additions to POD
Martin Renvoize [Fri, 29 Oct 2021 12:22:59 +0000 (13:22 +0100)]
Bug 28729: Additions to POD

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 43dbcec3aeb4a30f531f1786d635f1ce47f051cc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28729: Unit tests
Martin Renvoize [Tue, 19 Oct 2021 15:57:10 +0000 (16:57 +0100)]
Bug 28729: Unit tests

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit b942d1371476ebedc0bda2b2b446b08f84955594)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28729: Make Koha::Email->send_or_die handle returnpath
Martin Renvoize [Tue, 19 Oct 2021 15:57:25 +0000 (16:57 +0100)]
Bug 28729: Make Koha::Email->send_or_die handle returnpath

Koha used to rely on Mail::Sendmail for sending emails. As an SMTP
client, the library would extract the from address from the Sender
header to pass along in the MAIL FROM: field of the SMTP protocol [1].

This was overlooked when we moved to Email::Stuffer/Email::Simple and
there's a different behavior as it expects the envelope to be passed and
falls back to extracting the 'From' header when said envelope is not
found [2].

This patchset re-introduces the behavior from Mail::Sendmail by
overriding the send_or_die method locally (in Koha::Email) and doing the
right thing.

Unless an explicit {from} parameter is passed, it extracts the MAIL FROM
envelope from the Sender header, as Mail::Sendmail did, and calls
$self->SUPER::send_or_die with the right parameters.

To test:
1. Apply the unit tests
2. Run:
   $ kshell
   k$ prove t/Koha/Email.t
   => FAIL: Sender is not handled correctly!
3. Apply this patch
4. Repeat 2
   => SUCCESS: Tests pass!
   The from parameter is correct!
   No Sender header sent!
5. Sign off :-D

[1] https://metacpan.org/dist/Mail-Sendmail/source/lib/Mail/Sendmail.pm#L284
[2] https://metacpan.org/pod/Email::Sender::Manual::QuickStart#envelope-information

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
AMENDED (SHORTENED)
-        my @headers = $self->email->header_str_pairs;
-        foreach my $pair ( pairs @headers ) {
-            my ( $header, $value ) = @$pair;
-            $args->{from} = $value if $header eq 'Sender';
-        }
-
-        # Remove the Sender header
-        $self->email->header_str_set('Sender');
+        $args->{from} = $self->email->header_str('Sender');
+        $self->email->header_str_set('Sender'); # remove Sender header

Tested with same results (scrambled domains):
From: noreply@mydevserver.com
Cc: marcel@email.nl
To: test@somewhere.nl
Reply-To: bieb@mydevserver.com
Return-Path: postmaster@mydevserver.com

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit f647b67af7fc767bf0aa062abdda5b8baa459687)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28904: Fix typo and display
Martin Renvoize [Mon, 1 Nov 2021 09:52:26 +0000 (09:52 +0000)]
Bug 28904: Fix typo and display

Fix typo in template: Newletter => Newsletter
Fix latest newsletter editor definition.. it's a has not an array.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit ded631f39e82352a713a252af714b4e2907c4c2f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28904: Update team list to include newsletter editors
Martin Renvoize [Wed, 27 Oct 2021 14:37:07 +0000 (15:37 +0100)]
Bug 28904: Update team list to include newsletter editors

It seems we stopped recording the newsletter editor as part of the team
for a while :(.

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: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 6c85c1eac7b77665269e2baa33643854e5108853)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28904: Add newsletter editor to about page display
Martin Renvoize [Wed, 27 Oct 2021 14:27:45 +0000 (15:27 +0100)]
Bug 28904: Add newsletter editor to about page display

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: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 77448b618d1865a21815d434f071a223d706f21b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29329: Remove stray character in opac-detail.tt
Lucas Gass [Tue, 26 Oct 2021 19:52:24 +0000 (19:52 +0000)]
Bug 29329: Remove stray character in opac-detail.tt

1. Have  OpacBrowseResults on.
2. Make search with many results.
3. Go to the record detail page
4. Click 'Browse results'
5. At the bottom of the container notice the stray "s".
6. apply patch
7. Try again, the "s" is gone!

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: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e7a5d78a69e118a8f34e4816292df0bf27cd1bb4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27884: Add tests
David Gustafsson [Wed, 15 Sep 2021 13:32:35 +0000 (15:32 +0200)]
Bug 27884: Add 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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit cd5c1be348f75b3f7a38d0bcaf5757153d7d1e88)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27884: Add html support for report mails
David Gustafsson [Thu, 4 Mar 2021 16:54:22 +0000 (17:54 +0100)]
Bug 27884: Add html support for report mails

To test:
1) Create a new notice, for example with Koha module "Patrons",
   name/code TEST and message body "<strong>testing<strong>".
2) Create a new sql report, the query could be someting like:
   SELECT "<number>" as `borrowernumber`, "to@example.com", as `email`, "from@example.com" as `from`;
   where "<number>" is a valid borrowernumber.
3) Run patron_emailer.pl --report=<id> --notice=TEST --module=members -commit
   where <id> is the report id.
4) Check the message_queue table that the content_type column has been
   set to text/html; charset="UTF-8".
5) Ideally process the message queue and veriy that the sent email is displayed
   as rendered html.
6) Run tests in t/db_dependent/Reports/Guided.t

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 43066b8cd372cbfe1736e3022c333b6ed88c1f59)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 25459: Makes barcode position respect units in patron cards layout
Maryse Simard [Mon, 11 May 2020 18:20:42 +0000 (14:20 -0400)]
Bug 25459: Makes barcode position respect units in patron cards layout

When using any unit besides postscript points, barcode positionning
doesn't work correctly. There is an error in the calculation: the unit
factor must be applied to the individual card part only and not to the
full page position.

This patch moves the unit part of the calculation to the right place.

To test :
1. Create a working patron card setup, using postscript points:
    card template, layout and card batch. Use barcode and at least
    one other element (text or images) in the layout.
    => Some tips for testing:
        - activate guides for the layout
        - use a template and a batch containing more than one card; the
        displacement will be different for each card and depend on the
        barcode position relative to the bottom left of the entire page.
2. Change units from postscript points to any other unit.
    => At least for the layout, but changing it in the template will
    scale the page as well.
4. Export the card batch.
3. Note the guides are scaled to fit the new unit and the lower left
corner of text and images are still correctly placed relative to the
guides, but the barcode is not.
    => In some cases, the barcode even seem to not print at all since
    it's new coordinates are out of screen.
4. Apply patch.
5. Generate the batch again.
6. Note the barcode now appears exactly where it should.

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit a1f9e8efb6fe8e3cf77ae095e4795eff39baf568)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29350: Don't need to escape the 'delete' TT methods
Jonathan Druart [Thu, 28 Oct 2021 13:27:00 +0000 (15:27 +0200)]
Bug 29350: Don't need to escape the 'delete' TT methods

Will be needed by bug 22605.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit f99366a54ecb0d41e56d73a05f34592efb4e3790)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29075: 'OPAC info' removed in branches.pl
Jérémy Breuillard [Wed, 27 Oct 2021 13:24:43 +0000 (13:24 +0000)]
Bug 29075: 'OPAC info' removed in branches.pl

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

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

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

Signed-off-by: Owen <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 01df4ba3f297250611f523bbe5efa6fa6c056bfe)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29283: (QA follow-up) Remove code duplication
Joonas Kylmälä [Sun, 31 Oct 2021 12:22:06 +0000 (12:22 +0000)]
Bug 29283: (QA follow-up) Remove code duplication

We have already a search filter for active orders.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 396a256ae50ada5e2874f4ad5a59cb5ff85722ed)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29283: Don't attempt to cancel cancelled orders
Nick Clemens [Wed, 20 Oct 2021 13:06:06 +0000 (13:06 +0000)]
Bug 29283: Don't attempt to cancel cancelled orders

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

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

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 9aa8470382a78558baadcfb13dc545410cc0e70f)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 26871: Flush SIP2 cache on every SIP request
Joonas Kylmälä [Sun, 10 Oct 2021 11:01:29 +0000 (11:01 +0000)]
Bug 26871: Flush SIP2 cache on every SIP request

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

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

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

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

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

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 8fa126ee40eba088af32228a5e369cd8a526a126)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 14999: Make sure order prices are not mixed-up
Joonas Kylmälä [Sat, 2 Oct 2021 12:28:52 +0000 (12:28 +0000)]
Bug 14999: Make sure order prices are not mixed-up

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

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

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

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

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 58a69fb12944523391e5113ae6e326fd2d0887d9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29364: Revert changes to framework visibility made by Search.t
Jonathan Druart [Fri, 29 Oct 2021 08:33:57 +0000 (10:33 +0200)]
Bug 29364: Revert changes to framework visibility made by Search.t

To recreate run:

drop database koha_kohadev;
create database koha_kohadev;

restart_all

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 21347f064db47bbd49a1ce4a503ad2f9e6c9e62e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>