koha.git
2 years agoUpdate release notes for 21.11.05 release v21.11.05
Kyle M Hall [Tue, 26 Apr 2022 17:56:00 +0000 (17:56 +0000)]
Update release notes for 21.11.05 release

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoIncrement version for 21.11.05 release
Kyle Hall [Tue, 26 Apr 2022 15:06:55 +0000 (11:06 -0400)]
Increment version for 21.11.05 release

2 years agoFix translations for Koha 21.11.05
Jonathan Druart [Fri, 18 Mar 2022 09:26:48 +0000 (10:26 +0100)]
Fix translations for Koha 21.11.05

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoMerge remote-tracking branch 'koha-translate/21.11.05-translate-20220426' into 21...
Kyle Hall [Tue, 26 Apr 2022 13:36:28 +0000 (09:36 -0400)]
Merge remote-tracking branch 'koha-translate/21.11.05-translate-20220426' into 21.11.x

2 years agoBug 30584: Fix ES mapping creation
Jonathan Druart [Thu, 21 Apr 2022 17:23:14 +0000 (19:23 +0200)]
Bug 30584: Fix ES mapping creation

We need to tell DT that we are adding/removing row, not only deal
manually with the DOM.

This patch also fixes the following bug: if you add or remove a row from
the "biblio" tab, then go to another tab and back to "biblio", all
changes were gone (bug existed prior to bug 29893).

Test plan:
Add, edit and remove mappings, switch from tabs and save.
Use the filters, save (29893 regression test)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoTranslation updates for Koha 21.11.05
Koha translators [Tue, 26 Apr 2022 13:25:38 +0000 (10:25 -0300)]
Translation updates for Koha 21.11.05

2 years agoBug 30583: Fix hold system for translated templates
Jonathan Druart [Thu, 21 Apr 2022 14:30:24 +0000 (16:30 +0200)]
Bug 30583: Fix hold system for translated templates

There are missing quotes, and the translate script is messing up with
the generated template.

Error is:
Template process failed: file error - parse error - holds_table.inc line 216-217: unexpected token (hold)

The generated line, without this patch is:
216 <td><input %]="%]" class="printholdslip" data-reserve_id="[%" hold.reserve_id="hold.reserve_id" html="html" name="printholdslip" type="button" value="Recibo" |="|"></td>
With this patch applied:
216  <td><input class="printholdslip" data-reserve_id="[% hold.reserve_id | html %]" name="printholdslip" type="button" value="Recibo"></td>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
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>
2 years agoBug 30525: Items batch modification broken
Owen Leonard [Wed, 13 Apr 2022 14:07:53 +0000 (14:07 +0000)]
Bug 30525: Items batch modification broken

This patch modifies instances in the code which try to get cookies
using:

my %cookies = parse CGI::Cookie($cookie);

In some cases the relevant lines can be removed because they are unused.
In others it can be replaced with:

my %cookies = CGI::Cookie->fetch();

To test, apply the patch and restart_all. Test the following pages to
confirm they load without errors:

- Circulation -> Offline circulation file upload
- Circulation -> Offline circulation -> Add to queue

- Tools -> Batch item modification
- Tools -> Stage MARC for import
- Tools -> Staged MARC management
- Tools -> Batch patron modification
- Tools -> Upload local cover image

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30532: (bug 29957 follow-up) Fix '$cookie->value'
Jonathan Druart [Thu, 21 Apr 2022 13:05:24 +0000 (15:05 +0200)]
Bug 30532: (bug 29957 follow-up) Fix '$cookie->value'

We got
 Can't call method "value" on unblessed reference at /kohadevbox/koha/opac/opac-messaging.pl line 86

$cookie can be an arrayref, we should retrieve the session id using
CGI->cookie('CGISESSID')

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30376: Fix missing mandatory date acquired error on item save
Jonathan Druart [Wed, 6 Apr 2022 15:00:36 +0000 (17:00 +0200)]
Bug 30376: Fix missing mandatory date acquired error on item save

Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30172: Enqueue the job even if rabbitmq is not reachable
Jonathan Druart [Thu, 24 Mar 2022 15:24:06 +0000 (16:24 +0100)]
Bug 30172: Enqueue the job even if rabbitmq is not reachable

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30172: Prevent race condition when enqueuing a new task
Jonathan Druart [Thu, 24 Feb 2022 09:41:16 +0000 (10:41 +0100)]
Bug 30172: Prevent race condition when enqueuing a new task

As we are sending the job to the rabbitmq before in the transaction, the
worker can receive the job to process before the transaction committed.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2 years agoBug 30498: DBRev 21.11.04.004
Kyle Hall [Fri, 15 Apr 2022 12:14:16 +0000 (08:14 -0400)]
Bug 30498: DBRev 21.11.04.004

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30498: Corresponding DBIx change for SearchField
Kyle Hall [Fri, 15 Apr 2022 12:13:00 +0000 (08:13 -0400)]
Bug 30498: Corresponding DBIx change for SearchField

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30498: Fix enum search_field.type
Marcel de Rooy [Fri, 8 Apr 2022 09:19:31 +0000 (09:19 +0000)]
Bug 30498: Fix enum search_field.type

Resolves sync issue with upgrades.

Test plan:
Run dbrev.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30481: DBRev 21.11.04.003
Kyle Hall [Fri, 15 Apr 2022 12:08:05 +0000 (08:08 -0400)]
Bug 30481: DBRev 21.11.04.003

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30481: Drop unique constraint deleteditemsstocknumberidx
Marcel de Rooy [Thu, 7 Apr 2022 11:59:53 +0000 (11:59 +0000)]
Bug 30481: Drop unique constraint deleteditemsstocknumberidx

Resolves a sync issue between database and schema caused by
differences between structure and upgrades. Note: newer
databases do not contain this index any longer.

Test plan:
Run dbrev.
Check SHOW CREATE TABLE deleteditems.
Verify that unique index has been dropped, regular index added.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30142: Remove spaces from ElasticSearch mapping MARC fields
Thomas Klausner [Mon, 21 Feb 2022 11:35:15 +0000 (12:35 +0100)]
Bug 30142: Remove spaces from ElasticSearch mapping MARC fields

A first step to "validate" the MARC mappings: Remove all whitespace, so
if a user enters "245a " (with a trailing whitespace, which can easily
happen when copy/pasting) we only store "245a" in the DB. This is
neccessary, because the ES indexer will throw an exception in an invalid
MARC mapping.

Test Plan:
* Go to /cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl
* Go to the Bibliographic Records Tab
* Enter "100 a b c " (notice the whitespaces!) in the first "mapping"
  field
* Scroll down and save
* Go back to the Bibliographic Records Tab
* The spaces are still there

Now apply the patch

* Repeat the above steps
* After saving you should see "100abc" without any spaces in the
  "mapping" field

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30406: Add column filters before hiding columns
Julian Maurice [Fri, 1 Apr 2022 08:16:09 +0000 (10:16 +0200)]
Bug 30406: Add column filters before hiding columns

The code that adds column filters works only on visible columns, so we
should hide columns after filters are created

Test plan:
1. Apply patch
2. Go to Tables settings. Hide city_state for the cities table.
3. Create some cities and go to the cities page
4. Verify that filtering works as expected.
5. Make the city_state column appear. Verify that filtering on this
   column works too

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30426: Add missing C4::Auth and C4::Output imports
David Cook [Thu, 31 Mar 2022 23:02:35 +0000 (23:02 +0000)]
Bug 30426: Add missing C4::Auth and C4::Output imports

This patch adds missing function imports for C4::Auth and C4::Output
in the opac/svc/suggestion script.

Test plan:

1. Go to http://localhost:8081/cgi-bin/koha/admin/didyoumean.pl
2. Turn on some plugins
3. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
4. Note in your browser's Network tab that the call to
   http://localhost:8080/cgi-bin/koha/svc/suggestion?render=stub&q=test
   generates a 200 response instead of a 500 error

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30432: Fix random failure
Jonathan Druart [Wed, 6 Apr 2022 14:34:51 +0000 (16:34 +0200)]
Bug 30432: Fix random failure

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30432: Specify 'me' for biblionumber when limiting items
Nick Clemens [Fri, 1 Apr 2022 12:48:54 +0000 (12:48 +0000)]
Bug 30432: Specify 'me' for biblionumber when limiting items

To test:
1 - Apply only unit tests
2 - prove t/db_dependent/Koha/Holds.t
3 - It fails
4 - Apply this patch
5 - prove t/db_dependent/Koha/Holds.t
6 - It passes!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30432: Unit test
Nick Clemens [Fri, 1 Apr 2022 12:48:27 +0000 (12:48 +0000)]
Bug 30432: Unit test

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: (follow-up) correct spelling QA complaint
Nick Clemens [Fri, 25 Mar 2022 12:20:52 +0000 (12:20 +0000)]
Bug 29957: (follow-up) correct spelling QA complaint

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: Add --keep-cookie option to koha-create
Marcel de Rooy [Fri, 25 Mar 2022 08:20:46 +0000 (08:20 +0000)]
Bug 29957: Add --keep-cookie option to koha-create

As requested on comment99. Personally I do not feel that it
should be a requirement for adding a koha-conf entry though.
Note that koha-create does/did not even support adding multiple
line entries to koha-conf like we do here now.
But it might be a start for adding them?

Test plan:
The following tweak might help you to test without running the
complete koha-create, while still convincing you:

[1] cp debian/templates/koha-conf-site.xml.in /etc/koha/test.conf
[2] Add the following line in debian/scripts/koha-create. Append
    if after the BCRYPT_SETTINGS= line on L652:
    generate_config_file test.conf test.xml; exit
[3] Run debian/scripts/koha-create --keep-cookie A
[4] Check if you see <do_not_remove_cookie>A<..> in test.xml.
[5] Run debian/scripts/koha-create --keep-cookie A --keep-cookie B
[6] Check for two lines in test.xml
[7] Run debian/scripts/koha-create clone_name
[8] Check that the __KEEP_COOKIE__ line is gone in test.xml.
[9] Undo the tweak by removing test.xml and /etc/koha/test.conf,
    and removing the added line from koha-create.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: Add example lines in koha-conf.xml
Marcel de Rooy [Fri, 18 Mar 2022 07:17:39 +0000 (07:17 +0000)]
Bug 29957: Add example lines in koha-conf.xml

Test plan:
Just comments. Nothing to test.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: using new name for deny list.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: Let check_api_auth return created cookie
Marcel de Rooy [Thu, 17 Mar 2022 09:21:46 +0000 (09:21 +0000)]
Bug 29957: Let check_api_auth return created cookie

The cookie created on L1496 is useless, since it is not returned.
We could either remove the cookie creation (unchanged behavior).
But since check_api_auth is expected to return a cookie when it is ok,
I opt for returning the cookie here (corrected behavior).

Test plan:
Logout in staff.
Check on staff: /cgi-bin/koha/svc/localization?id=1
You should have a 400 response.
Login with staff credentials (incl. manage_itemtypes)
Revisit same URL.
You should see a JSON response.
Check if you can hit other staff pages.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: Adjust push @$cookie statements in Auth
Marcel de Rooy [Wed, 16 Mar 2022 12:43:07 +0000 (12:43 +0000)]
Bug 29957: Adjust push @$cookie statements in Auth

We can now use $cookie_mgr->replace_in_list instead. This
effectively removes duplicates and keeps the newest cookie.

Note: In the test plan below we are just verifying if
this patch did not change behavior. The replace_in_list
routine has been tested already in a unit test.

Test plan:
Run t/db_dependent/Auth.t
Login at OPAC.
Hit some opac and staff pages.
Perform an Advanced search on OPAC.
Check cookies in browser.
Logout.
Check cookies again. Verify with your do_not_remove_cookie lines
in koha-conf.xml.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: Replace clear_all_cookies in Auth.pm
Marcel de Rooy [Mon, 14 Mar 2022 11:30:57 +0000 (11:30 +0000)]
Bug 29957: Replace clear_all_cookies in Auth.pm

Test plan:
Enable language selection and have two languages.
Change language.
Check cookie value in browser for KohaOpacLanguage.
Logout.
Verify that cookie has been cleared in browser.

Add do_not_remove_cookie line for KohaOpacLanguage in koha-conf.
Restart, flush.
Login again.
Change language.
Check cookie value in browser for KohaOpacLanguage.
Logout.
Verify that cookie still contains the language.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: (follow-up) Turn allow list into deny list
Marcel de Rooy [Wed, 23 Mar 2022 07:41:54 +0000 (07:41 +0000)]
Bug 29957: (follow-up) Turn allow list into deny list

See the discussion on the Bugzilla report.
It might be easier to work with a deny list.

Test plan:
Run t/CookieManager.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: Introduce Koha::CookieManager
Marcel de Rooy [Fri, 11 Mar 2022 10:15:30 +0000 (10:15 +0000)]
Bug 29957: Introduce Koha::CookieManager

Test plan:
Run t/CookieManager.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29957: Clear cookies on logout
Jonathan Druart [Thu, 27 Jan 2022 11:33:57 +0000 (12:33 +0100)]
Bug 29957: Clear cookies on logout

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Amended: Reverted the change to $cookies to minimize changes.
Fixed Auth.t where checkauth is being mocked.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30118: (QA follow-up) Fix Perl Critic issues
Kyle M Hall [Wed, 30 Mar 2022 16:34:55 +0000 (16:34 +0000)]
Bug 30118: (QA follow-up) Fix Perl Critic issues

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30118: Make holds_block_checkin in SIP behave like in Koha interface.
Matthias Meusburger [Wed, 17 Mar 2021 13:14:25 +0000 (14:14 +0100)]
Bug 30118: Make holds_block_checkin in SIP behave like in Koha interface.

In koha interface, a warning is displayed when an item on hold is returned
only if the return is for this specific item.

This patch does the same in SIP: the return is blocked when holds_block_checkin
is enabled and there is a hold on a specific item and this is the very item
being returned.

Test plan:

The following behavior is expected in SIP:

 - An item is returned, and there is a reservation on record-level: block
 - An item is returned, and there is a reservation on this very item: block
 - An item is returned, and there is a reservation on another item: allow

Signed-off-by: Sonia <sonia.bouis@univ-lyon3.fr>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29787: Add plugin version to plugin search results
Tomas Cohen Arazi [Mon, 10 Jan 2022 12:03:26 +0000 (09:03 -0300)]
Bug 29787: Add plugin version to plugin search results

This patch adds a new column to plugins search results: 'Latest
version'.

It takes the tag_name in both GitHub and GitLab cases and passes it to
the template.

To test:
1. Have this on your koha-conf.xml file:

 <plugin_repos>
    <repo>
        <name>ByWater Solutions</name>
        <org_name>bywatersolutions</org_name>
        <service>github</service>
    </repo>
    <repo>
        <name>Theke Solutions</name>
        <org_name>thekesolutions</org_name>
        <service>gitlab</service>
    </repo>
    <repo>
        <name>PTFS Europe</name>
        <org_name>ptfs-europe</org_name>
        <service>github</service>
    </repo>
 </plugin_repos>

2. Restart all services:
   $ restart_all
3. Search for the term 'barclaycard'
=> SUCCESS: You get results from PTFS Europe (Github)
=> FAIL: They don't include plugin version
4. Search for the term 'innreach'
=> SUCCESS: You get results from Theke (Gitlab)
=> FAIL: They don't include plugin version
5. Apply this patch
6. Repeat 2-4
=> SUCCESS: Results show up
=> SUCCESS: Results include the plugin version
7. Sign off :-D

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30402: Import authorities subroutines to ImportBatch script
Aleisha Amohia [Mon, 28 Mar 2022 16:37:30 +0000 (05:37 +1300)]
Bug 30402: Import authorities subroutines to ImportBatch script

The following authorities subroutines are used by the ImportBatch
script but are not accessible, because they aren't imported. This
caused MARC importing errors.
- GetAuthorityXML
- ModAuthority
- DelAuthority

These affected the BatchCommitRecords and BatchRevertRecords routines,
and it wasn't caught because there are no tests written for them.

To test:
1. Find an existing authority record, or import one to use.
2. Save this authority record (export/download).
3. Go to Admin -> Record matching rules. Create a new record matching
   rule for authorities that matches on 001, Local-Number index.
4. Go to Tools -> Stage MARC for import. Upload the authority file you
   just downloaded.
5. Change record type to authority.
6. Under 'Look for existing items in catalog?', set the record matching
   rule to the rule you just made which matches on 001. If matching
   record found, replace the existing one. If no match is found, ignore.
7. Stage the record. Once complete, a match should've been found.
8. Go to Staged MARC management.
9. Import the batch into the catalog. Notice it hangs and never
   completes.

10. Apply the patch and restart services.
11. Repeat steps 4-9. This time importing should be successful.

Sponsored-by: Educational Services Australia SCIS
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30107: When editing desks default to the branch the desk belongs to
Lucas Gass [Wed, 9 Mar 2022 18:41:56 +0000 (18:41 +0000)]
Bug 30107: When editing desks default to the branch the desk belongs to

TO test:
1. Turn on UseCirculationDesks
2. Add some desks via Administration > Circulation desks, make several and have them belong to different libraries.
3. Go edit some of those desks and notice the Library: dropdown always defaults to the users logged in branch
4. Apply patch
5. Try editing desk again, now the dropdown should default the library that the desk belongs to.
6. Try making a new desk and make sure it defaults to the logged in branch

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26669: (QA follow-up) Update last run when report run by name
Nick Clemens [Wed, 30 Mar 2022 12:25:55 +0000 (12:25 +0000)]
Bug 26669: (QA follow-up) Update last run when report run by name

This alters the svc scripts to set the report id after fetchign the report object
to ensure it is passed to exectue query

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26669: Adjust POD
Nick Clemens [Wed, 30 Mar 2022 12:25:42 +0000 (12:25 +0000)]
Bug 26669: Adjust POD

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26669: Last Run if report not always updated
Fridolin Somers [Thu, 14 Jan 2021 15:46:25 +0000 (16:46 +0100)]
Bug 26669: Last Run if report not always updated

The last run of a report is updated only if method execute_query() is
called with report_id.
This whas missing for :
- when report is run publicly
- when report is sent by email
- when report is exported

Patch changes the method signature to use a hash of params, in order to
easily avoid some params.

Test plan :

1) Create a report.
2) Run report.
3) Check the report listing.  Confirm that the last run info on the report is updated.
4) Make report public.
5) Run report via public url.
6) Check the report listing.  Confirm that the last run info on the report IS NOT updated.
7) Schedule the report to run at a given time and e-mailed to an address.
8) After the report runs at the scheduled time, check the report listing.  Confirm that the last run info on the report IS NOT updated.
9) Run report.
10) Export results.
11) Check the report listing.  Confirm that the last run info on the report IS NOT updated AT THE TIME OF THE EXPORT.

Questionable (I don't know if this is addressed):
12) Run report on backend through a cron job and send results via e-mail.
13) Check the report listing.  Confirm that the last run info on the report IS NOT updated.

14) Apply patch.
15) Rerun steps 2-13.  Confirm that steps 3, 6, 8, 11, and 13 DO UPDATE the last run info.

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26669: Avoid a warn in update_sql
Fridolin Somers [Thu, 14 Jan 2021 15:41:07 +0000 (16:41 +0100)]
Bug 26669: Avoid a warn in update_sql

In C4/Reports/Guided.pm update_sql() called by test suite return warn :
Use of uninitialized value $sql in substitution (s///)

Test plan :
Run prove t/db_dependent/Reports/Guided.t and see warning disapearing
(whouchhhh)

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28610: Elasticsearch 7 - hits.total is now an object
Kevin Carnes [Tue, 8 Feb 2022 13:48:19 +0000 (14:48 +0100)]
Bug 28610: Elasticsearch 7 - hits.total is now an object

In Elasticsearch 7 hits.total is now an object which is not always an exact
value. You can always get an exact total by adding a track_total_hits
parameter set to true when using the Elasticsearch search method

To test:
1) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
2) If you observe an error about types, apply patch for bug 25669
3) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
4) Observe that tests with count fail
5) Apply patch
6) Observe that tests with count pass
7) Sign off

Sponsored-by: Lund University Library
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30377: Fix two CGI::param called in list context-warnings
Marcel de Rooy [Mon, 28 Mar 2022 12:07:43 +0000 (12:07 +0000)]
Bug 30377: Fix two CGI::param called in list context-warnings

Trivial fix.

Test plan:
Delete two lines from opac search history.
Verify results. Check plack-opac-error.log.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 22038: Fix excel export if CurrencyFormat is FR
Didier Gautheron [Fri, 11 Dec 2020 09:46:04 +0000 (10:46 +0100)]
Bug 22038: Fix excel export if CurrencyFormat is FR

DataTables excel export is broken if number decimal separator is a comma.

Test plan:
1 - Set syspref CurrencyFormat to US
2 - Export as excel a table with decimal numbers, patrons list with fines
for example.
3 - Open in libreoffice or excel, numbers are ok.
4 - Set syspref CurrencyFormat to FR
5 - Export and open again, number are wrong 25,10 is imported as 2510
6 - Apply patch
7 - Redo 1 to 4
8 - Excel export, number is 25,10

Signed-off-by: hakam <hakam@inlibro.com>
Signed-off-by: Florian Bontemps <florian.bontemps@biblibre.com>
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>
2 years agoBug 29517: Check if agerestriction field is mapped before fetching biblio
Nick Clemens [Thu, 18 Nov 2021 12:03:36 +0000 (12:03 +0000)]
Bug 29517: Check if agerestriction field is mapped before fetching biblio

This patch simply adds a check of cached values to see if agerestriction enabled before
fetching the biblio object

To test:
1 - prove -v t/db_dependent/Holds.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30222: Remove warning
Jonathan Druart [Fri, 25 Mar 2022 08:05:18 +0000 (09:05 +0100)]
Bug 30222: Remove warning

Use of uninitialized value in string ne at misc/cronjobs/automatic_renewals.pl line 193.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30222: Further simplify logic
Nick Clemens [Tue, 15 Mar 2022 13:34:39 +0000 (13:34 +0000)]
Bug 30222: Further simplify logic

For any borrower, we are either:
1 - following their preference, and that should set 'wants_email'
OR
2 - Never sending / following the cron, and can determine 'wants_email'
    from the 'send_notices' variable

This patch adds an 'else' if not using preferences to accomplish this

Follow test plan on previous patches

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30222: Simplify logic for reporting
Nick Clemens [Fri, 11 Mar 2022 13:24:33 +0000 (13:24 +0000)]
Bug 30222: Simplify logic for reporting

This patch adds two new variables:
$wants_email and $wants digest

These are used to simplify checks on whether notices should be sent

To test:
1 - Apply patch
2 - Confirm notices are not sent of pref is 'cron' and send_notcies flag not set
3 - Confirm notices are sent if pref is cron and send_notices flag is set and borrower
    does not have preference set for auto renewals
4 - Confirm notices not sent if pref is set to follow messaging preference and borrower
    does not have preferences set for auto_renewals
5 - Confirm regular notices sent if pref is set to follow messaging preferences and borrower
    does have the preference set but not digest
6 - Confirm digest notices sent if pref is set to follow messaging preferences and borrower
    does have the preference set and wants digest

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30222: Only send auto renewal digest wehn there is an update
Nick Clemens [Fri, 11 Mar 2022 12:00:26 +0000 (12:00 +0000)]
Bug 30222: Only send auto renewal digest wehn there is an update

Currently, the code sends an email to the patron when there is any error that is not
'too_soon' - we also don't include issues that are 'too_soon', so emials may be missing information

This patch changes the code to:
1 - push all issues that were checked to the report when a borrower wants a digest
2 - adds a variable to track when any of the issues has been updated, and checkes this when
    sending digests
3 - if nothing has been updated, no report is sent to the patron

To test:
 1 - Checkout an item, marked for autorenewal, backdated to be overdue to a patron
 2 - Set preferences
    AutoRenewalNotices = 'according to patron messaging preferences'
    EnhancedMessagingPreferences = 'Allow'
 3 - Set the patrons preference for auto renewal to email+digest
 4 - Ensure the patron has an email
 5 - Place an item level hold for another patron on the issued item
 6 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
 7 - Check patron record/notices tab
 8 - Note item not renewed, patron notified
 9 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
10 - Note item not renewed, status not changed, patron notified again
11 - Apply patch
12 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
13 - Item not renewed, patron no notified
14 - Checkout another item marked for auto renewal to the patron, but due in the future
     ensure it is outside of 'no renewal before'
15 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
16 - Patron not notified, items not renewd
     Change to status of 'auto_too_soon' is not notified
17 - Checkout a third item, marked for auto renew, overdue
18 - place an item level hold for another patorn on third item
19 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
20 - patron is notified, nothing renewed, all statuses reported
21 - cancel the item level hold on third item
22 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
23 - item renewed, patron notified, all statuses reported
24 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
25 - nothing renewed, patron not notified, only change is one issue 'auto_too_soon'

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30003: Prevent double up of point-of-sale items
Jake Deery [Tue, 8 Feb 2022 11:40:06 +0000 (11:40 +0000)]
Bug 30003: Prevent double up of point-of-sale items

This patch prevents the double submission of point-of-sale items when form validation fails at the first submission

Test plan
 1.  Navigate to /cgi-bin/koha/pos/pay.pl
 2.  Add an item from 'items to purchase'
 3.  Under 'collect payment', click submit without altering the form
 4.  See 'This field is required.'
 5.  Now, fill a value in 'Amount tendered' that satisfies or exceeds 'Amount being paid'
 6.  The payment should succeed
 7.  Navigate to /cgi-bin/koha/pos/register.pl
 8.  See duplicate lines in Transactions
 9.  Apply patch
10.  Repeat 2-6
11.  Navigate to /cgi-bin/koha/pos/register.pl
12.  Confirm only a single line was added

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29576: (QA follow-up) Rename road type to street type to match patron form
Katrin Fischer [Sun, 27 Mar 2022 00:05:02 +0000 (00:05 +0000)]
Bug 29576: (QA follow-up) Rename road type to street type to match patron form

This changes the pref description so the field name matches what
we use in the patron form.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 34874: Add streettype and B_streettype to PrefillGuaranteeField
Didier Gautheron [Thu, 25 Nov 2021 14:39:14 +0000 (15:39 +0100)]
Bug 34874: Add streettype and B_streettype to PrefillGuaranteeField

To test :
 1) modify PrefillGuaranteeField system preference
 2) road type for main and alternate addresses aren't in the list
 3) Apply patch
 4) Redo 1, now they are

https://bugs.koha-community.org/show_bug.cgi?id=29576
Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30114: Koha offline circulation will always cancel the next hold when issuing...
Kyle Hall [Tue, 15 Feb 2022 16:33:33 +0000 (11:33 -0500)]
Bug 30114: Koha offline circulation will always cancel the next hold when issuing item to a patron

If a record has holds on it, and, using offline circulation, an item on
that is checked out to a patron that did not have a hold on the record,
the next hold that would have trapped that item will be canceled.

1) Place two bib level holds on an item for two patrons
2) Find a third patron, note his or her cardnumber
3) Create the file test.koc by copying and pasting the following into a
   text editor

Version=1.0 Generator=kocTest GeneratorVersion=0.7
2008-06-11 12:24:11 547 issue PATRONCARDNUMBER ITEMBARCODE

note the fields are tab delemited, ensure the tabs do not get lost
when copying and pasting!

4) Upload the offline circ action, and commit the action
5) Note the item was checked out to the third patron
6) Note one of the other patron's holds were canceled
7) Reset your database
8) Apply this patch
9) Test again, no hold should be canceled!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30114: Add Unit Tests
Kyle Hall [Mon, 7 Mar 2022 14:07:14 +0000 (09:07 -0500)]
Bug 30114: Add Unit Tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29501: Use the default transport
Tomas Cohen Arazi [Mon, 21 Mar 2022 16:45:16 +0000 (13:45 -0300)]
Bug 29501: Use the default transport

This patch makes the script pass the default SMTP transport to the
->send_or_die call.

The default is picked as this is the current behavior. New enhancements
could add the *library_id* to the message_queue table, and allow using
different transports depending on that. But it is out of the scope of
this bug.

To test:
1. Verify messages are being sent.
2. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
JD amended patch: revert
-        unless $format =~ m[^html$|^csv$|^ods$];
+        unless $format =~ m/^html$|^csv$|^ods$/;
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency
Tomas Cohen Arazi [Tue, 8 Mar 2022 11:36:56 +0000 (11:36 +0000)]
Bug 29501: (follow-up) Remove unused MIME::QuotedPrint dependency

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29501: Remove MIME::Lite dependency
Tomas Cohen Arazi [Thu, 18 Nov 2021 12:41:44 +0000 (09:41 -0300)]
Bug 29501: Remove MIME::Lite dependency

The library usage is discouraged by the current maintainer and we don't
use it in the codebase anymore.

To test:
1. Apply this patch
2. Run:
   $ git grep MIME::Lite
=> SUCCESS: No uses of the removed library
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29501: Make gather_print_notices.pl use Koha::Email
Tomas Cohen Arazi [Thu, 18 Nov 2021 12:40:22 +0000 (09:40 -0300)]
Bug 29501: Make gather_print_notices.pl use Koha::Email

This patch makes the cronjob script use Koha::Email and thus relying on
configured SMTP settings instead of just trying localhost.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30393: Make datatables wrapper handle searching for %, _, \
Tomas Cohen Arazi [Wed, 30 Mar 2022 10:10:26 +0000 (12:10 +0200)]
Bug 30393: Make datatables wrapper handle searching for %, _, \

This patch makes searching for '%','_' and '\' work by escaping those
symbols in the query before sending them to the API.

To test:
1. Go to the cities page
2. Add two cities:
   - 'Cordoba %'
   - 'Buenos Aires _'
   - 'London \'
3. Use the column search on the name, alternating _, \ and % as the query
=> FAIL: Weird behavior
4. Apply this patch and reload
5. Repeat 3
=> SUCCESS: Filtering works correctly!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30244: Include lost items in list of hidden items
Nick Clemens [Fri, 11 Mar 2022 14:24:27 +0000 (14:24 +0000)]
Bug 30244: Include lost items in list of hidden items

When building search results for XSLT we generate and pass a list of hidden
itemnumbers.

We do skip the lost items in our parsing, however, we neglect to add the itemnumber
to the hidden list

This patch simply adds the lost itemnumbers to the list

There is more work to be done here to simpliofy this process, however, this patch resolves
the issue and can be backported to stable branches

To test:
1 - Set systempreference hidelostitems to "Don't show"
2 - Edit a record to set one item as lost and one as available
3 - Perform an OPAC search that returns the record above
4 - Note that the lost item shows in availability line
5 - Click on the record - note the lost item does not show on details
6 - Apply patch
7 - Reload search results
8 - Lost itme no longer displays

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30175: Toggle digest boxes when loading messaging preferences
Nick Clemens [Thu, 24 Feb 2022 12:12:27 +0000 (12:12 +0000)]
Bug 30175: Toggle digest boxes when loading messaging preferences

To test:
1 - Define default messaging preferences for a patron category, checking a transport and the digest only boxes
2 - Create a new patron of a different category
3 - Change the category to the one set above
4 - Note that checkboxes are checked, but digest boxes are disabled
5 - Save patron - the digest boxes are not saved
6 - Apply patch
7 - Repeat 2&3
8 - Note checkboxes for digest are checked and enabled
9 - Save patron and confirm options are saved

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30251: (bug 10902 follow-up) With IndependentBranches non-superlibrarians do...
Janusz Kaczmarek [Tue, 8 Mar 2022 21:42:44 +0000 (22:42 +0100)]
Bug 30251: (bug 10902 follow-up) With IndependentBranches non-superlibrarians do not get autocomplete list in circulation module

Having IndependentBranches on, a librarian who is not superlibrarian
does not get a autocomplete hint list when entering a part of the
patron's name (while performing check out, etc.)  Koha registers
an error:

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Column 'branchcode' in where clause is ambiguous at
.../Koha/Objects.pm line 312

This is due to fix to the bug 10902 -- addig "prefetch => 'branchcode'" to
the attributes of the query in circ/ysearch.pl, while having branchcode
in the search parameters.

Test plan:
----------

1. Have IndependentBranches on, PatronAutoComplete set to 'Try.
   Be a librarian without superlibrarian privileges.  Have some
   patrons defined.
2. In the main input field on the top, with Check out active, try to
   put 3+ characters from the known user name/cardnumber etc. You
   will get no hint.
3. Apply the patch.
4. Repeat 2.  You should now see an autocomplete hint list.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29103: Change desk when checking in a waiting reserve
Nicolas Legrand [Tue, 18 Jan 2022 10:45:50 +0000 (10:45 +0000)]
Bug 29103: Change desk when checking in a waiting reserve

A check in should relocate a waiting hold under the current desk. But
the current behaviour when confirming the hold is to dismiss the
modal, the item is still attached to the preceding desk.

This patch mimicks the print and confirm behaviour to trigger the desk
change.

Plan test:

1. Add some desks to you library (syspref UseCirculationDesks and
   Administration -> Patrons and circulation -> Circulation desks.

2. Set a desk in your session (Circulation -> Set library and desk)

3. Have some waiting hold attach to a desk (make a hold on a checked
   out item and return it).

4. Change your current desk.

5. Check in again the item, click on confirm.

6. Go to the item notice detail, it appears as waiting at your first
   desk.

7. Apply patch.

8. Check in again the item.

9. go to the item notice detail, it should appear at your current
   desk.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30165: (follow-up) Allow objects.search usage outside OpenAPI
Tomas Cohen Arazi [Thu, 24 Mar 2022 12:52:04 +0000 (09:52 -0300)]
Bug 30165: (follow-up) Allow objects.search usage outside OpenAPI

Our objects.search helper is written for being used in our API
controllers, which get their query parameters processed by the OpenAPI
plugin, using JSON::Validator.

Particularly, the 'q' parameter is defined as 'multi' on our spec, which
means objects.search always gets it as an arrayref.

As the Objects.t tests are not using the OpenAPI plugin, a hashref is
generated as only one q= is being passed. This patch adds an extra
validation on objects.search, for the non-arrayref use case and does the
right thing.

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

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>
2 years agoBug 30110: Fix concatenation during assignements
Jonathan Druart [Mon, 21 Feb 2022 09:50:55 +0000 (10:50 +0100)]
Bug 30110: Fix concatenation during assignements

There are several occurrences of `my $var += ` or .= in the code.
It should not cause problems but it's confusing.

Test plan:
Read the patch and confirm that the changes make sense.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30199: Do not generate jwt if patron does not exist
Jonathan Druart [Fri, 18 Mar 2022 09:26:48 +0000 (10:26 +0100)]
Bug 30199: Do not generate jwt if patron does not exist

This is a follow-up patch for bug 29543. If an invalid cardnumber has
been used we should not generate a token.

Test Plan:
1. Set SelfCheckoutByLogin to 'cardnumber'.
2. Go to http://localhost:8080/cgi-bin/koha/sco/sco-main.pl
3. Enter an invalid carnumber like 'thisisabadcardnumber'
4. See the appropriate message "Sorry The userid thisisabadcardnumber was not found in the database. Please try again."
5. Try again with a different cardnumber and notice the same exact error message including the 'thisisabadcardnumber' cardnumber.
6. Apply this patch
7. Restart all the things!
8. Repeat steps 2-4
9. Try again with a different cardnumber, you should now see the correct
   cardnumber!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25251: (follow-up) Remove alertNoItems
Nick Clemens [Tue, 22 Mar 2022 11:40:07 +0000 (11:40 +0000)]
Bug 25251: (follow-up) Remove alertNoItems

We should not need this function any longer

I left the else conditional just in case

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25251: Remove alert from disabled buttons
Nick Clemens [Mon, 14 Mar 2022 17:05:56 +0000 (17:05 +0000)]
Bug 25251: Remove alert from disabled buttons

This patch removes the alert, but adds a stopPropagation call
in order to not close the menu when the disabled buttons are clicked

To test:
1 - Find a record with items in the staff interface
2 - Click edit
3 - Note 'Edit items in a batch, 'Delete items in a batch', and 'Delete
    all items' are grayed out
4 - Note hovering displays a note that there are no items
5 - Click on each anyway, an alert is generated, menu is closed
6 - Apply patch
7 - Reload page
8 - Click on each disabled option and confirm
    - there is no more alert
    - the menu does not close
9 - Confirm tooltip is displayed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30282: overdues report does not display subtitle, part_name, part_number
Blou [Fri, 11 Mar 2022 20:54:51 +0000 (15:54 -0500)]
Bug 30282: overdues report does not display subtitle, part_name, part_number

In circ/overdue.pl, the Title column is the result of includes/biblio-title.inc display.  The code of biblio-title.inc means to display subtitle, part_number and part_name from biblio table, but nothing but commas show up because those fields are never retrieved by overdue.pl

To reproduce:
1) have an item whose biblio.subtitle, part_name and part_number and non-empty.
2) issue it, then set it late (overdue).
3) go to the report page (circ/overdue.pl) and make it appear.
4) subtitle, part_number and part_name do not appear, although they are meant to by biblio-title.inc code
5) apply the patch and try again.

It's a simple fix of adding the fields in the database query.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29893: Redraw the tables from other tabs without paging
Jonathan Druart [Thu, 17 Feb 2022 16:39:52 +0000 (17:39 +0100)]
Bug 29893: Redraw the tables from other tabs without paging

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29893: Make sure the form will be submitted after the draw calls
Jonathan Druart [Wed, 9 Feb 2022 10:07:40 +0000 (11:07 +0100)]
Bug 29893: Make sure the form will be submitted after the draw calls

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29893: Prevent ES mappings UI to remove hidden rows
Jonathan Druart [Mon, 17 Jan 2022 14:45:06 +0000 (15:45 +0100)]
Bug 29893: Prevent ES mappings UI to remove hidden rows

If you are editing ES mappings and you use the DataTable filtering option,
the table won't contain all the mappings you have in the DB.
If the form is submitted they will be removed and data will be lost!

Test plan:
Edit ES mappings, filter and submit the form.
Confirm that the table are redrawn before the form submission which
prevent data loss

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26328: Add test
Jonathan Druart [Mon, 21 Mar 2022 14:56:21 +0000 (15:56 +0100)]
Bug 26328: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26328: Cast barcode from varchar to integer for incremental barcode
David Cook [Fri, 4 Dec 2020 05:36:04 +0000 (05:36 +0000)]
Bug 26328: Cast barcode from varchar to integer for incremental barcode

Without this patch, the incremental barcode generation will
treat 978e0143019375 as having an exponent and interpret it as a very
large number.

With this patch, the incremental barcode generation will first cast
barcode varchar strings to integers before finding a max() value.
In this case 978e0143019375 becomes 978 instead of
1.7976931348623157e308

Test plan:

0. Using koha-testing-docker

Before applying patch:

1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=autobarcode
2. Set to "generated in the form 1, 2, 3"
3. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
4. Add item with barcode 978e0143019375
5. Click "p - Barcode"
6. Note the barcode is "Inf"

After applying patch:
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
2. Click "p - Barcode"
3. Note the barcode is "39999000019194"

Signed-off-by: Marjorie <marjorie.barry-vila@collecto.ca>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29802: add 'me' to filter_by_visible_in_opac query
Nick Clemens [Fri, 18 Mar 2022 14:25:14 +0000 (14:25 +0000)]
Bug 29802: add 'me' to filter_by_visible_in_opac query

This patch prefixes all of the fields in OpacHiddenItems with
"me." before searching.

Unit tests added to cover this case1

To test:
1 - Create a public list
2 - Set OpacHiddenItems to:
    biblionumber: [1]
3 - Attempt to view list in OPAC
4 - Booom
5 - Aply patch
6 - Reload list
7 - Success

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29802: Unit tests
Nick Clemens [Thu, 6 Jan 2022 16:03:56 +0000 (16:03 +0000)]
Bug 29802: Unit tests

prove -v t/db_dependent/Koha/Items.t
prove -v t/db_dependent/XSLT.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26685: Move Starman out of debian/control.in and into cpanfile (2)
Mason James [Wed, 2 Mar 2022 05:30:49 +0000 (18:30 +1300)]
Bug 26685: Move Starman out of debian/control.in and into cpanfile (2)

defining package as 'recommended', as suggested

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26685: Move starman out of debian/control.in and into cpanfile
David Cook [Thu, 15 Oct 2020 02:06:44 +0000 (02:06 +0000)]
Bug 26685: Move starman out of debian/control.in and into cpanfile

to test...
 - apply patch
 - build and install new package
 - confirm starman package displays correctly in about.pl page

Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30161: Remove duplicate z3950_search include
Marcel de Rooy [Wed, 23 Feb 2022 13:14:03 +0000 (13:14 +0000)]
Bug 30161: Remove duplicate z3950_search include

Speaks for itself.

Test plan:
Check if the acqui z3950 search works as expected.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30253: Remove a double mana_success parameter
Marcel de Rooy [Wed, 9 Mar 2022 12:46:10 +0000 (12:46 +0000)]
Bug 30253: Remove a double mana_success parameter

Remove the line without the scalar.

Test plan:
Just look at the code.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30008: (bug 29690 follow-up) Fix Invalid data, cannot decode metadata object
Jonathan Druart [Thu, 17 Mar 2022 15:19:16 +0000 (16:19 +0100)]
Bug 30008: (bug 29690 follow-up) Fix Invalid data, cannot decode metadata object

Test plan:
1 - Find a record in the staff catalog
2 - Edit the record
3 - In the 520 notes field, add an ASCII escape character (27 decimal, 1b hex)
    On ubuntu Ctrl+Shift+u, then 1b, enter
4 - Save the record
5 - Set syspref ShowComponentRecords to 'both...'
6 - On record details: New->New child record
7 - Save the record
8 - Attempt to view the parent record in the staff client and opac

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29940: Don't surround value by quote
Jonathan Druart [Thu, 27 Jan 2022 14:30:17 +0000 (15:30 +0100)]
Bug 29940: Don't surround value by quote

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 29940: Phase out jquery.cookie.js in the OPAC
Owen Leonard [Tue, 25 Jan 2022 12:32:28 +0000 (12:32 +0000)]
Bug 29940: Phase out jquery.cookie.js in the OPAC

This patch replaces the use of jquery.cookie.js in the OPAC with the
newer js-cookie plugin. The patch adds the latest version of the
js-cookie library and removes the old jquery.cookie plugin.

To test, apply the patch and go to the advanced search page in the OPAC.

- Perform a search using a number of different limits and settings, e.g.
  keyword, item type, and sort-by.
- On the search results page you should see at the top of the results
  list a link to "Return to the last advanced search."
- The link should take you back to the advanced search page with all the
  same settings filled into the form.
- A search with the "More options" view enabled in the advanced search
  form should result in a link which returns to the "More options" view.
- Searching via the "quick search" form at the top of the page should
  clear the cookies which were set in order to remember the advanced
  search. See
  https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector for
  information on viewing your browser's stored cookies.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30266: Hide pickup location input on waiting hold
Nick Clemens [Thu, 10 Mar 2022 12:23:42 +0000 (12:23 +0000)]
Bug 30266: Hide pickup location input on waiting hold

This patch updates the holds table to always insert a hidden input when a hold is 'found'
and covers the case where the hold is 'found' but doesn't match known statuses

To test:
 1 - Place two holds on a record for two different patrons, with different pickup locations
 2 - Check in one item at expected branch to set waiting
 3 - Then either:
    - Use batch modification or item editor to change the holding branch for the item
    - Sign in to a different branch and manually transfer the item back to it's home location
 4 - View the holds for the record
 5 - Note the 'Pickup library' column is blank for that hold
 6 - Change pickup location for other hold and press 'Update holds'
 7 - Note the waiting hold is still blank, and now second hold has no pickup location
 8 - Check the DB and note the first hold has had the pickup location changed
 8 - Apply patch
 9 - Delete holds and repeat 1-4
10 - Note the waiting hold now displays:
    Hold expected at {Branch}, please checkin to verify status
11 - Change location for second hold and update holds
12 - COnfirm location chanegd correctly and first hold unaffected

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30004: Prevent TooMany from executing too many SQL queries
Julian Maurice [Wed, 2 Feb 2022 12:53:48 +0000 (13:53 +0100)]
Bug 30004: Prevent TooMany from executing too many SQL queries

If a maximum number of checkouts allowed is defined in circulation
rules, C4::Circulation::TooMany will loop over all patron's checkouts.
When a patron has several hundreds of checkouts, it can really slow down
the checkout process by several seconds (or even tens of seconds)

This patch does two things:
- Always prefetch item data so that `$c->item` does not execute an
  additional SQL query at every iteration of the loop. Item data is
  always needed at the first line of the loop, so there is really no
  downside for doing this.
- Build the `@types` array only once, out of the checkouts loop. Since
  it does not depend at all on patron's checkouts data, it does not make
  sense to build it inside the loop.

Test plan:
1. Before applying the patch, create a patron with a lot of checkouts.
   I tested with 1000 checkouts, but the slowness should be noticeable
   with less.
2. Make sure you have a circulation rule (one that apply to your patron
   and the item(s) you will check out for testing) with a maximum number
   of checkouts allowed
3. Check out an item for the patron with a lot of checkouts. Measure the
   time it takes.
4. Apply the patch
5. Check out another item (or check in and then check out the same item
   used in step 3). Measure the time it takes and compare it to step 3.
   It should be faster now.
6. Run `prove t/db_dependent/Circulation/TooMany.t`

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30183: Fetch flatPickr instance prior to custom search definition
Martin Renvoize [Mon, 14 Mar 2022 14:32:31 +0000 (14:32 +0000)]
Bug 30183: Fetch flatPickr instance prior to custom search definition

This patch updates teh search customisations in ill-list-table to
properly fetch the existing flatpickr instances for date searches.

To test:
1. Have at least one ILL request on the ILL requests page
2. Open the broser inspector
3. Choose a date on the left hand form
=> FAIL: Errors in the console, search doesn't work
4. Apply this patch
5. Reload
6. Repeat 2-3
=> SUCCESS: No more errors, filtering works!
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30325: (Bug 30098 follow-up) Fix broken patron search redirect when one result
Fridolin Somers [Mon, 21 Mar 2022 22:18:57 +0000 (12:18 -1000)]
Bug 30325: (Bug 30098 follow-up) Fix broken patron search redirect when one result

Bug 30098 fixed patron search behavior when a later page has only 1 result, but broke the redirect when there is only a single result from search.

To test:
1 - Perform a patron search that returns 41 results, on koha-testing-docker, 'a' works
2 - Go to second page of results, works
3 - On third page you remain in results and are not redirected
4 - Perform a patron search that return only 1 result, name or cardnumber
5 - You get redirected to this patron page

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30165: (follow-up) Fix GET /acquisitions/orders
Tomas Cohen Arazi [Tue, 15 Mar 2022 18:18:22 +0000 (15:18 -0300)]
Bug 30165: (follow-up) Fix GET /acquisitions/orders

This patch fixes the particular use case of the orders route, which has
a slightly modified version of the objects.search helped, embeded in the
controller itself. This controller gets adjusted to the fact q will now
be an array.

Because of the latter, we end up requiring more code duplication
regarding the query fix, so I moved it to an internal sub that gets
reused.

To test:
1. Apply the previous patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/*
=> FAIL: It t/db_dependent/api/v1/acquisitions_orders.t fails!
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: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30165: Make q parameter 'multi'
Tomas Cohen Arazi [Tue, 15 Mar 2022 12:42:19 +0000 (09:42 -0300)]
Bug 30165: Make q parameter 'multi'

This patch changes the q_param definition so the defined query parameter
is repeatable. This way JSON::Validator will always generate an arrayref
for it and won't skip occurences.

The objects.search helper is updated to always consider the 'q'
parameter as an array, as expected.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.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: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30165: Regression tests
Tomas Cohen Arazi [Fri, 25 Feb 2022 11:45:26 +0000 (08:45 -0300)]
Bug 30165: Regression tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25285: Fix wrong message about required Koha version in plugins
Tomas Cohen Arazi [Wed, 9 Mar 2022 11:23:38 +0000 (08:23 -0300)]
Bug 25285: Fix wrong message about required Koha version in plugins

When you install a plugin that requires a newer Koha version, it reports
this:

<<
Warning: This report was written for a newer version of Koha. Run at your own risk.
>>

It is wrong in a couple ways:
- It is not a report.
- It feels like it dates back to when plugins were only run i.e.
  pre-hooks, etc.

This patch proposes a change to reflect this.

To test:
1. Verify the string changes make sense to you
2. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30214: (QA follow-up) Clarify code comment
Katrin Fischer [Sun, 6 Mar 2022 12:19:34 +0000 (12:19 +0000)]
Bug 30214: (QA follow-up) Clarify code comment

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30214: Add ACCTDETAILS notice to verified self registration
Martin Renvoize [Wed, 2 Mar 2022 16:14:18 +0000 (16:14 +0000)]
Bug 30214: Add ACCTDETAILS notice to verified self registration

This patch adds the ACCTDETAILS notice trigger to the opac self
registration process. Allowing new users, with varification enabled,
to receive the ACCTDETAILS notice immediately after their account is
varified.

Test plan
1) Enable AutoEmailOpacUser system preference
2) Ensure the ACCTDETAILS notice is configured
3) Ensure `PatronSelfRegistrationVerifyByEmail` is enabled
4) Register a new user via the opac self registration process using an
   email address you have access to
5) Verify the user by following the link in the verification email you
   should have received.
6) The new user should have been created and you should be able to see
   the account details notice in their associated notices
7) Confirm that the email address used above has received the notice.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 30214: Add ACCTDETAILS notice to self registeration
Martin Renvoize [Wed, 2 Mar 2022 16:03:55 +0000 (16:03 +0000)]
Bug 30214: Add ACCTDETAILS notice to self registeration

This patch adds the ACCTDETAILS notice trigger to the opac self
registration process. Allowing new users, without varification enabled,
to receive the ACCTDETAILS notice immediately after their account is
created.

Test plan
1) Enable AutoEmailOpacUser system preference
2) Ensure the ACCTDETAILS notice is configured
3) Ensure `PatronSelfRegistrationVerifyByEmail` is disabled
4) Register a new user via the opac self registration process using an
   email address you have access to
5) The new user should have been created and you should be able to see
   the account details notice in their associated notices
6) Confirm that the email address used above has received the notice.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17648: (QA follow-up) Restore imediate sending of the notice
Martin Renvoize [Tue, 1 Mar 2022 16:47:52 +0000 (16:47 +0000)]
Bug 17648: (QA follow-up) Restore imediate sending of the notice

The original notice was sent using SendAlerts, which triggers
immediately on submission and doesn't wait for the cron task.

This patch restores that immediacy and also fixes a bug in the imports
on the original patch.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17648: (QA follow-up) Further code cleaning
Martin Renvoize [Tue, 1 Mar 2022 16:24:55 +0000 (16:24 +0000)]
Bug 17648: (QA follow-up) Further code cleaning

We actually have a Koha::Patron method to do all the work of finding the
right patron primary email address for notices.. we can use that here
instead of doing it long hand.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 17648: ACCTDETAILS notice does not show in notices.pl
Kyle Hall [Mon, 28 Feb 2022 14:03:29 +0000 (09:03 -0500)]
Bug 17648: ACCTDETAILS notice does not show in notices.pl

The ACCTDETAILS notice apparently bypasses message_queue; notices are sent directly to the linux mail queue.

Test Plan:
1) Apply this patch
2) Create a new patron with an email address
3) Note the patron's ACCTDETAILS notice shows in the patron's messages

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27812: DBRev 21.04.002
Kyle Hall [Fri, 25 Mar 2022 13:31:12 +0000 (09:31 -0400)]
Bug 27812: DBRev 21.04.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27812: (QA follow-up) Fix atomicupdate
Martin Renvoize [Tue, 1 Mar 2022 16:00:10 +0000 (16:00 +0000)]
Bug 27812: (QA follow-up) Fix atomicupdate

We removed a bit too much from the skeliton here ;)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27812: Add DBRev to warn of the change to the account details notice
Kyle Hall [Mon, 28 Feb 2022 13:30:07 +0000 (08:30 -0500)]
Bug 27812: Add DBRev to warn of the change to the account details notice

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>