koha-ffzg.git
15 months agoBug 33309: Index items after renewal transaction completes
Nick Clemens [Wed, 22 Mar 2023 19:12:01 +0000 (19:12 +0000)]
Bug 33309: Index items after renewal transaction completes

This patch ensures a record is indexed only after the renewal transaction
has completed successfully. Otherwise the job cannot be found by the background process
worker, becaue it was not yet in the DB

To test:
1 - Make sure you are using ES, and the es indexer is running
2 - tail -f /var/log/koha/kohadev/*.log
3 - Issue an item to a patron and renew it
4 - Note error in es-indexer-output.log like:
    [2023/03/21 12:22:36] [WARN] No job found for id=157 main:: /kohadevbox/koha/misc/workers/es_indexer_daemon.pl (129)
5 - Apply patch
6 - Renew again
7  There should be no error
8 - Search for the record and confirm items info displays correctly
9 - View the background jobs in admin, confirm the most recent job has completed

Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33137: Make column names match
Lucas Gass [Thu, 9 Mar 2023 13:17:05 +0000 (13:17 +0000)]
Bug 33137: Make column names match

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33137: Add call number to pay-fines-table and table settings
Lucas Gass [Wed, 8 Mar 2023 16:40:24 +0000 (16:40 +0000)]
Bug 33137: Add call number to pay-fines-table and table settings

To test:
1. Apply patch and restart_all
2. From a patron's Accounting tab add some invoices that are related to an item.
3. From the 'Make a payemnt' notice the new Call number column.
4. Using Table settings, make sure you can properly hide the column.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33137: Add Home library to pay-fines-table and table settings
Lucas Gass [Wed, 8 Mar 2023 16:24:26 +0000 (16:24 +0000)]
Bug 33137: Add Home library to pay-fines-table and table settings

To test:
1. Apply patch and restart_All
2. From a patron's Accounting tab add some invoices that are related to an item.
3. From the 'Make a payemnt' notice the new Home library column. Make sure it displays correctly and is the same as what you see on the 'Transactions' tab.
4. Using Table settings, make sure you can properly hide the column.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33019: Make sure ES records are indexed the first time
Nick Clemens [Wed, 15 Feb 2023 10:50:33 +0000 (23:50 +1300)]
Bug 33019: Make sure ES records are indexed the first time

This patch ensures records are indexed when they are created.
Previously, we were launching the indexer inside of of a transaction.
This meant that the job was being enqueued, but not being found by the
worker, becaue it was not yet in the DB

This patch skips record indexing in the transaction, and moves the indexing
command after

To test:
1 - Make sure you are using ES, and the es indexer is running
2 - tail -f /var/log/koha/kohadev/*.log
3 - Create a new record
4 - Note error in es-indexer-output.log like:
    [2023/03/21 12:22:36] [WARN] No job found for id=157 main:: /kohadevbox/koha/misc/workers/es_indexer_daemon.pl (129)
5 - Apply patch
6 - Create another record
7  There should be no error
8 - Search for the record and confirm it can be found
9 - View the background jobs in admin, confirm the most recent job has completed

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33290: Fix incorrect variable in http-client.js
Jonathan Druart [Tue, 21 Mar 2023 07:52:42 +0000 (08:52 +0100)]
Bug 33290: Fix incorrect variable in http-client.js

Silly error from
  commit 821808ec31176d662e518418c9ff8a71948e1a4b
  Bug 32939: Use APIClient to replace PATCH requests

+        const body = params.body
+            ? typeof str === "string"
+                ? params.body
+                : JSON.stringify(params.body)
+            : undefined;

  typeof str === "string"
must be
  typeof params.body === "string"

Test plan:
With this patch, bug 33289 is not working properly. The body contains
  "pref_var=value"
instead of
  pref_var=value
and the syspref `var` contains `value"`

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32833: Fix cataloguing/value_builder/unimarc_field_121a.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:52 +0000 (11:58 +0100)]
Bug 32833: Fix cataloguing/value_builder/unimarc_field_121a.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32832: Fix cataloguing/value_builder/unimarc_field_120.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:52 +0000 (11:58 +0100)]
Bug 32832: Fix cataloguing/value_builder/unimarc_field_120.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32831: Fix cataloguing/value_builder/unimarc_field_117.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:52 +0000 (11:58 +0100)]
Bug 32831: Fix cataloguing/value_builder/unimarc_field_117.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32830: Fix cataloguing/value_builder/unimarc_field_116.pl
Julian Maurice [Fri, 3 Feb 2023 10:58:52 +0000 (11:58 +0100)]
Bug 32830: Fix cataloguing/value_builder/unimarc_field_116.pl

Use event parameter

This is part of the refactoring happening in bug 30975

Test plan:
1. Verify that the plugin continues to work as before

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
https://bugs.koha-community.org/show_bug.cgi?id=32831

15 months agoBug 33282: Feed an array of titles so that no dialog message appears
Pedro Amorim [Mon, 20 Mar 2023 18:21:06 +0000 (17:21 -0100)]
Bug 33282: Feed an array of titles so that no dialog message appears

Including but not limited to the one we're testing for

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
15 months agoBug 33282: Move get_title to index.js to be invoked by different specs
Pedro Amorim [Mon, 20 Mar 2023 18:19:53 +0000 (17:19 -0100)]
Bug 33282: Move get_title to index.js to be invoked by different specs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
15 months agoBug 33282: Remove useless intercept
Pedro Amorim [Mon, 20 Mar 2023 18:07:27 +0000 (17:07 -0100)]
Bug 33282: Remove useless intercept

JD amended patch: replace "redundant" with "useless". It's not the same
intercept, but we don't need the one removed by this patch.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
15 months agoBug 33282: Rename Dialog.spec.ts to Dialog_spec.ts
Pedro Amorim [Mon, 20 Mar 2023 18:05:52 +0000 (17:05 -0100)]
Bug 33282: Rename Dialog.spec.ts to Dialog_spec.ts

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
15 months agoBug 32923: Allow to embed user_roles for agreements
Jonathan Druart [Wed, 22 Mar 2023 09:25:56 +0000 (10:25 +0100)]
Bug 32923: Allow to embed user_roles for agreements

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
15 months agoBug 32923: Fix licenses spec
Pedro Amorim [Mon, 20 Mar 2023 13:25:19 +0000 (13:25 +0000)]
Bug 32923: Fix licenses spec

Bug 32713 is now validating embed and brought this flaw to light.
Before this patch, listing licenses on ERM would result in a 400 bad request

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30555: (follow-up) Add messages about the introduced changes
Tomas Cohen Arazi [Mon, 20 Mar 2023 12:37:44 +0000 (09:37 -0300)]
Bug 30555: (follow-up) Add messages about the introduced changes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30555: DBRev 22.12.00.014
Tomas Cohen Arazi [Mon, 20 Mar 2023 12:37:10 +0000 (09:37 -0300)]
Bug 30555: DBRev 22.12.00.014

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30555: Add more sample notice for sms messages
Shi Yao Wang [Fri, 15 Apr 2022 15:42:29 +0000 (11:42 -0400)]
Bug 30555: Add more sample notice for sms messages

Adds sms sample notice for due, hold, checkin and checkout

Test plan:
1. Check that there are no SMS messages for these notices (Tools > Notices & slips):
   . CHECKIN - Item check-in (digest)
   . CHECKOUT - Item check-out (digest)
   . DUE - Item due reminder
   . DUEDGST - Item due reminder (digest)
   . PREDUE - Advance notice of item due
   . PREDUEDGST - Advance notice of item due (digest)
   . HOLD - Hold available for pickup
2. Apply the patch.
3. Update the database (./installer/data/mysql/updatedatabase.pl)
4. Refresh page
5. Check that there are now SMS notices for the notices listed in step 1.
6. Sign-off!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 19361: (QA follow-up) Make sure "Not an authorised value" appears in the pull...
Katrin Fischer [Fri, 17 Mar 2023 17:43:18 +0000 (17:43 +0000)]
Bug 19361: (QA follow-up) Make sure "Not an authorised value" appears in the pull down

This is to make sure that the small icon with the additional tooltip
style explanation is not as easily missed.

Also updates text slightly:
* Pull downs: "X (Not an authorised value)"
* Tooltip: "The current value X is not configured for the authorised value category controlling this subfield"

Switches from exclamation triangle to the more "alerting" exclamation-triangle :)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 19361: (QA follow-up) Make sure translatable string is wrapped in double quotes
Katrin Fischer [Fri, 17 Mar 2023 16:10:26 +0000 (16:10 +0000)]
Bug 19361: (QA follow-up) Make sure translatable string is wrapped in double quotes

This fixes the QA script complaint:

 FAIL koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
   FAIL   forbidden patterns
forbidden pattern: simple-quote string (line 125)

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 19361: Fix advanced cataloging editor dropdowns
Nick Clemens [Wed, 19 Oct 2022 14:37:34 +0000 (14:37 +0000)]
Bug 19361: Fix advanced cataloging editor dropdowns

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 19361: Display unauthorized values when cataloging and add a warning
Nick Clemens [Wed, 19 Oct 2022 13:56:51 +0000 (13:56 +0000)]
Bug 19361: Display unauthorized values when cataloging and add a warning

This patch adds a warning and tool tip when an unauthorised vlaue is encountered during item
or biblio editing, and adds the value to the list to allow preserving the value (in case the
librarian is only editing another part of the record, or there is some reason to retain)

To test:
1 - Edit a record in advanced cataloging editor
2 - Under settings click 'Show fields verbatim'
3 - Edit 942$c to 'HAM' or some other invalid itemtype
4 - Save record
5 - sudo koha-mysql kohadev
    UPDATE items SET location = 'HAM' WHERE biblionumber = {biblionumber from above}
6 - Edit the biblio and items, confirm the HAM value shows in dropdowns

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33266: Fix missing space in patron title
Matt Blenkinsop [Fri, 17 Mar 2023 17:48:22 +0000 (17:48 +0000)]
Bug 33266: Fix missing space in patron title

This patch fixes the missing space in patron-title.inc

Test plan:
1) Visit a patron's detail page and observe that there should be a
   missing space between the first name and the surname
2) Apply patch
3) The name should now be correctly formatted

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33060: Fix yes/no setting to 1/0 in system preference YAML files
Katrin Fischer [Thu, 23 Feb 2023 22:16:56 +0000 (22:16 +0000)]
Bug 33060: Fix yes/no setting to 1/0 in system preference YAML files

Boolean system preferences need to use 1 and 0 for true and false,
not yes and no now. This fixes a few occurences that have
been added in the last release:

* EnableItemGroups
* EnableItemGroupHolds
* ArticleRequestsOpacHostRedirection
* UseLocationAsAQInSIP

To test:
* Make sure these preferences save to the db as 0/1 as expected.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33227: (follow-up) Improve docs
Tomas Cohen Arazi [Mon, 20 Mar 2023 11:48:22 +0000 (08:48 -0300)]
Bug 33227: (follow-up) Improve docs

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33227: Remove invalid spec and adjust the code accordingly
Tomas Cohen Arazi [Thu, 16 Mar 2023 13:50:33 +0000 (10:50 -0300)]
Bug 33227: Remove invalid spec and adjust the code accordingly

The spec contains a non-standard definition for the body param. Removing
it from the spec makes us need to handle the 'body' manually in the case
of JSON data.

This patch basically does that. It also changes the uses of
$c->validation, which are discouraged by the
Mojolicious::Plugin::OpenAPI dev/maintainer. I do it to highlight what
we must do in other places and the fact that there's no behavior change.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t \
           xt/api.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33227: Unit tests
Tomas Cohen Arazi [Wed, 15 Mar 2023 14:14:19 +0000 (11:14 -0300)]
Bug 33227: Unit tests

This patch adds a unit test that launches the swagger-cli validator
against our spec.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33108: (follow-up) Don't let restart die if ES indexer not running
Nick Clemens [Fri, 3 Mar 2023 15:31:21 +0000 (15:31 +0000)]
Bug 33108: (follow-up) Don't let restart die if ES indexer not running

This fixes the restart action in koha-common to continue with starting
services even if the last service cannot be stopped (because it may not
be running)

This needs a larger fix, to ensure all stopped services return a
warning, for now 'do_stop' simply returns the last success/failure

To test:
1 - Apply patch
2 - reset_all
3 - sudo koha-es-indexer --stop kohadev
4 - restart_all
5 - You are notified that ES indexer was not running
6 - You are notified that soem services could not be stopped
7 - The services are started

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33108: (follow-up) Don't die, only warn if not using ES
Nick Clemens [Thu, 2 Mar 2023 13:44:34 +0000 (13:44 +0000)]
Bug 33108: (follow-up) Don't die, only warn if not using ES

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33108: Make init handle koha-es-indexer
Tomas Cohen Arazi [Wed, 1 Mar 2023 19:04:25 +0000 (16:04 -0300)]
Bug 33108: Make init handle koha-es-indexer

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 33108: (follow-up) Fix typo

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33108: Teach koha-list filter elasticsearch
Tomas Cohen Arazi [Wed, 1 Mar 2023 18:46:26 +0000 (15:46 -0300)]
Bug 33108: Teach koha-list filter elasticsearch

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33108: koha-es-indexer added
Tomas Cohen Arazi [Wed, 1 Mar 2023 13:22:22 +0000 (10:22 -0300)]
Bug 33108: koha-es-indexer added

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33076: (QA follow-up) Update context hint to "EDIFACT message QUOTE"
Katrin Fischer [Fri, 17 Mar 2023 21:46:21 +0000 (21:46 +0000)]
Bug 33076: (QA follow-up) Update context hint to "EDIFACT message QUOTE"

As discussed on the bug, this updates the hint to make it
easier for translators to decide on the correct translation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32713: (QA follow-up) Tests now require more complex structures
Tomas Cohen Arazi [Fri, 17 Mar 2023 21:27:09 +0000 (18:27 -0300)]
Bug 32713: (QA follow-up) Tests now require more complex structures

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32923: (follow-up) Fix x-koha-embed from EHoldings/*/*
Jonathan Druart [Fri, 17 Mar 2023 14:07:37 +0000 (15:07 +0100)]
Bug 32923: (follow-up) Fix x-koha-embed from EHoldings/*/*

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33151: Improve translation of string in cities.tt and desks.tt
Owen Leonard [Mon, 6 Mar 2023 18:02:28 +0000 (18:02 +0000)]
Bug 33151: Improve translation of string in cities.tt and desks.tt

This patch adds a <span> tag around a string in both cities.tt and
desks.tt in order to improve translatability.

To test apply the patch and run the translation script to update the .po
files, e.g.

perl misc/translator/translate update fr-FR

Check the updated .po files:
 - Before the patch you would have found 'msgid "%s Searching: %s %s %s'
 - After the patch you should find 'msgid "Searching: %s'

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32804: (QA follow-up) Typo ahs and fix ImportBatch.t
Marcel de Rooy [Fri, 17 Mar 2023 08:43:32 +0000 (08:43 +0000)]
Bug 32804: (QA follow-up) Typo ahs and fix ImportBatch.t

Resolve:
    #   Failed test 'Item's biblioitemnumber has not changed'
    #   at t/db_dependent/ImportBatch.t line 407.
    #
    #          got: '4261'
    #     expected: '2371'

Do not compare $item1->biblionumber with $original_biblioitemnumber :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32804: (follow-up) Test that id's have not changed
Nick Clemens [Fri, 3 Mar 2023 12:18:40 +0000 (12:18 +0000)]
Bug 32804: (follow-up) Test that id's have not changed

Rather than assuming biblionumber and biblioitemnumber are the same, we
should test that they have not changed form their original values

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32804: Do not adjust biblionumber when replacing items during import
Nick Clemens [Thu, 2 Feb 2023 20:16:49 +0000 (20:16 +0000)]
Bug 32804: Do not adjust biblionumber when replacing items during import

This patch adjust the item matching at import to confirm that for a duplicate itemnumber or barcode
matches an existing item in the DB and uses the original biblionumber when updating the item.

When ordering in a consortium the items may be moved around, duplicate biblios added, and various matches found.
We should not allow importing of items to move them from 1 biblio to another, but  we should allow the imports
to succeed and assume itemnumber or barcode matches are authoritative. The responsibility for correct matching of items to biblio should fall on the creator of the files

To test:
 1 - Be using the sample data in koha testing docker
 2 - Stage the sample file on this report
 3 - Match on KohaBiblio(999$c) / Item processing: replace
 4 - Note the biblio match is "The complete novels / Austen, Jane"
 5 - View the staged marc, note the barcode 39999000004090 in an item
 6 - Search for that barcode
 7 - You find biblio "Five novels : complete and unabridged / Gustave Flaubert"
 8 - Import the file
 9 - Check the db:
     SELECT * FROM items WHERE biblionumber != biblioitemnumber;
10 - Note the mismatch
11 - Fix the item and set it as 'Music' type
     UPDATE items SET biblionumber = biblioitemnumber, itype='MU' WHERE biblionumber != biblioitemnumber;
12 - Apply patch, restart all
13 - Stage and import the file with the same settings
14 - Confirm the item is modified on its original biblio (99) and that item type is Book again
15 - Change itemnumber to avoid itemnumber match and reset type
     UPDATE items SET itype='MU', itemnumber=999 WHERE itemnumber=212;
16 - Stage and import with the same setttings
17 - Confirm the marcode match worked and item is updated to book on original record
18 - Delete the original item
19 - Stage and import the file with the same settings
20 - The item is successfully created
21 - Stage and import, but item processing option is 'add'
22 - Confirm 1 item ignored
23 - Check the db
     SELECT * FROM import_items WHERE barcode=39999000004090
24 - Confirm there is a line with 'error' and duplicate_barcode

JD amended patch
-        # We assume that when replaicing tiems we do not want to move them - the onus is on the importer to
+        # We assume that when replacing items we do not want to move them - the onus is on the importer to

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32804: Add unit tests
Kyle Hall [Mon, 6 Feb 2023 16:55:48 +0000 (11:55 -0500)]
Bug 32804: Add unit tests

JD amended patch
-    is( $item1->homebranch, $library->branchcode, "Item was overlayed succesfully" );
+    is( $item1->homebranch, $library->branchcode, "Item was overlaid successfully" );

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33059: Fix capitalizatoin of AV sample category descriptions
Katrin Fischer [Thu, 23 Feb 2023 21:21:02 +0000 (21:21 +0000)]
Bug 33059: Fix capitalizatoin of AV sample category descriptions

* Fixes capitalization
* Standardizes on e-book (see https://www.oxfordlearnersdictionaries.com/definition/english/e-book)
* Standardizes on audiobook (see https://www.oxfordlearnersdictionaries.com/definition/english/audiobook)

To test:
* This is a little difficult to test. What you'd need to do:
* Apply the patch
* Drop your database, recreate it, run the web installer
* Make sure to select the optional AV along with the mandatory to install
* Log into Koha after finishing the installer and go to administration >
  authorised values
* Review the existing sample values for incorrect capitalization in
  the different categories

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33100: (QA follow-up) Trivial QA fixes
Tomas Cohen Arazi [Fri, 17 Mar 2023 12:51:09 +0000 (09:51 -0300)]
Bug 33100: (QA follow-up) Trivial QA fixes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33100: Remove all punctuation at end of record
Nick Clemens [Tue, 7 Mar 2023 20:05:36 +0000 (20:05 +0000)]
Bug 33100: Remove all punctuation at end of record

This could potentially be overkill - if you have two records that only
differ in ending punctuation, you might get a false result - I don't
know how likely that is ( as I have mentioned before '!!!' is a band )

This seems a reasonable fix

To test:
1 - Set sysprefs as in bug 33159
2 - Edit a record, biblionumebr 3 is fine
3 - Add a comma to end of author subfield a
4 - Save and note relinked
5 - Apply patch, restart all
6 - Save again
7 - Linked to original record

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33100: Unit test
Nick Clemens [Tue, 7 Mar 2023 20:05:28 +0000 (20:05 +0000)]
Bug 33100: Unit test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33235: Fix cypress tests
Pedro Amorim [Wed, 15 Mar 2023 15:23:37 +0000 (14:23 -0100)]
Bug 33235: Fix cypress tests

Some inconsistencies leftovers from 32495 and 32997 were causing cypress tests to fail, this fixes them.

* Apply patch
* Run cypress tests and verify all pass

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33082: Add yellow buttons and page sections to 'copy order' pages
Katrin Fischer [Mon, 27 Feb 2023 21:44:09 +0000 (21:44 +0000)]
Bug 33082: Add yellow buttons and page sections to 'copy order' pages

When creating a new order from an existing order (copy),
there was no page section on the search results and the
submit buttons were not yellow (primary).

To test:
1. Make sure you have budgets, funds and vendors
2. In Acquisitions, search for a vendor
3. Create a basket
4. Add an order to that basket (Order from new (empty) record is easiest)
5. Add to the basket again, choosing the "From existing orders (copy)" option
6. Search for you previous order
7. The table of ordres has no white background (missing page-section) and
   the "Next" button is not yellow
8. Check the order and click Next
9. The "Duplicate orders" button is not yellow
10. Apply patch
11. Verify buttons are now yellow and the table has a white background

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 25856: Add suspend class to tr's of suspended holds
Lucas Gass [Thu, 16 Mar 2023 18:02:53 +0000 (18:02 +0000)]
Bug 25856: Add suspend class to tr's of suspended holds

To test:
1. Apply patch.
2. Place multiple holds on a record and then go suspend some of them.
3. Those suspended holds should now have a class of 'suspended'
4. Now you can add any kind of CSS you want to make those rows stand out. You can try adding this to IntranetUSerCSS:
.suspend > td {
color: red;
}

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33263: Fix random failure in patrons_search.t
Jonathan Druart [Fri, 17 Mar 2023 10:57:22 +0000 (11:57 +0100)]
Bug 33263: Fix random failure in patrons_search.t

There is a missing wait_for_ajax. After we click "next", we need to make
sure we are using the correct response.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33070: Remove use of can_edit_items
Kyle Hall [Thu, 23 Feb 2023 12:52:02 +0000 (07:52 -0500)]
Bug 33070: Remove use of can_edit_items

Test Plan:
1) Apply this patch
2) prove t/db_dependent/Koha/Acquisition/Order.t
3) git grep "can_edit_item("
   should return no results

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32983: Fix dropdown list when search for EBSCO's packages
Jonathan Druart [Wed, 8 Mar 2023 14:53:15 +0000 (15:53 +0100)]
Bug 32983: Fix dropdown list when search for EBSCO's packages

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33058: Update "fines" to "charges" for viewing a guarantees charges
Katrin Fischer [Thu, 23 Feb 2023 20:26:23 +0000 (20:26 +0000)]
Bug 33058: Update "fines" to "charges" for viewing a guarantees charges

Charges includes fines and fees, while fines are mostly
negative. Changing this according to our terminology
guidelines.

To test:
* Make sure the patron category of your patron is set
  to be 'can be guarantee' in administration
* Set  AllowStaffToSetFinesVisibilityForGuarantor and
   AllowPatronToSetFinesVisibilityForGuarantor to allow
* Set OpacPrivacy to allow
* Edit your patron, give it a guarantor and
  look at the "Show fines to guarantors setting" and hint
* Save and look at the label of the field on the details tab
* Go to the OPAC and log in
* Check the Privavy tab for the option to allow the guarantee
  to see your charges
* Apply patch. Verify:
  * System preference descriptions changes
  * Option and label names have changed in all steps above

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32180: Add required class to labels in ERM
Lucas Gass [Wed, 15 Mar 2023 20:39:27 +0000 (20:39 +0000)]
Bug 32180: Add required class to labels in ERM

To test:
1. Apply patch, yarn build
2. Add/edit Agreemnets, make sure all required fields have a red 'required' label
3. Check 'Add new period', 'Add new user', 'Add new license', 'Add new related agreement'.
4. Add/edit Licenses, make sure all required fields have a red 'required' label.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33056: Terminology: change 'fine' to 'charge'when making a payment or writeoff
Katrin Fischer [Thu, 23 Feb 2023 20:42:54 +0000 (20:42 +0000)]
Bug 33056: Terminology: change 'fine' to 'charge'when making a payment or writeoff

In the development meeting of Feb 22, 2023, we decided to change 'fine' to 'charge' when referring to various types of fees ('fine' should be limited to overdue fines).

To test:
0. Go to patron's account accounting tab, Make a payment section
   --> It will read: X has no outstanding fines.
   0.1 Create a manual invoice
   --> Use "Write off all" button, verify confirmation message says 'fines'
1. Add a manual fee to a patron's account
   1.1. Go to a patron's account > Accounting tab
   1.2. Click 'Create manual invoice'
   1.3. Enter an amount
   1.4. Click 'Save'
2. Pay an individual charge
   2.1. Click 'Make a payment'
   2.2. Click the 'Pay' button next to an individual charge
   --> In the browser tab title, it says 'Collect fine payment for ...'
   --> In the breadcrumbs, the last section is 'Pay an individual fine'
   --> The heading of the page is 'Pay an individual fine'
   --> The heading inside the payment tab is 'Pay an individual fine'
   2.3. Click 'Cancel' and go back to the 'Make a payment' tab
3. Pay an amount toward all charges
   3.1. Click 'Pay amount'
   --> In the browser tab title, it says 'Collect fine payment for ...'
   --> In the breadcrumbs, the last section is 'Pay an amount toward all fines'
   --> The heading of the page is 'Pay an amount toward all fines'
   --> The heading inside the payment tab is 'Pay an amount toward all fines'
   3.2. Click 'Cancel' and go back to the 'Make a payment' tab
4. Pay an amount toward selected charges
   4.1. Click 'Pay selected'
   --> In the browser tab title, it says 'Collect fine payment for ...'
   --> In the breadcrumbs, the last section is 'Pay an amount toward selected fines'
   --> The heading of the page is 'Pay an amount toward selected fines'
   --> The heading inside the payment tab is 'Pay an amount toward selected fines'
   4.2. Click 'Cancel' and go back to the 'Make a payment' tab
5. Write off an individual charge
   5.1. Click the 'Write off' button next to an individual charge
   --> In the browser tab title, it says 'Collect fine payment for ...'
   --> In the breadcrumbs, the last section is 'Write off an individual fine'
   --> The heading of the page is 'Write off an individual fine'
   --> The heading inside the payment tab is 'Write off an individual fine'
   5.2. Click 'Cancel' and go back to the 'Make a payment' tab
6. Write off selected charges
   6.1. Click 'Writeoff selected'
   --> In the browser tab title, it says 'Write off an amount for ...'
   --> In the breadcrumbs, the last section is 'Write off an amount toward selected fines'
   --> The heading of the page is 'Write off an amount toward selected fines'
   --> The heading inside the payment tab is 'Write off an amount toward selected fines'
   6.2. Click 'Cancel' and go back to the 'Make a payment' tab
7. Apply patch and repeat
   --> All fines should now be charges.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33076: Add context to "Quotes"
Katrin Fischer [Mon, 27 Feb 2023 22:13:01 +0000 (22:13 +0000)]
Bug 33076: Add context to "Quotes"

A quote as a part of quoted text and a quote as
part of the acquisition process need to be
translated differently at least in German.
This patch adds context to the terms, so we can
do that.

To test:
* Go to Tools > Quote editor
* Verify the heading of the page reads "Quotes"
* Enable EDIFACT system preference
* Go to Administration > EDI accounts
* Add a new account save
* Verify the table heading reads "Quotes"
* Apply patch - nothing should change

Verify the translation process:
* Run: gulp po:update --lang de-DE
* Verify the "Quotes" appear now separated by
  different context in
  misc/translator/po/de-DE-messages.po

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33126: Markup error in staff interface tab wrapper
Owen Leonard [Fri, 3 Mar 2023 13:40:03 +0000 (13:40 +0000)]
Bug 33126: Markup error in staff interface tab wrapper

This patch makes a minor correction to the tab WRAPPER directives: a
<li> which should be </li>.

The patch also modifies the example WRAPPER markup to correct an error
and clarify usage.

To test, apply the patch and test a page which has been updated to use
tab wrappers: The about page, basket groups, library transfer limits.
Tabs should continue to work as expected.

Before the patch, the about page source will include this:

<li role="presentation" class="active">
    <a href="about_panel" aria-controls="about_panel" role="tab" data-toggle="tab">
       Server information
    </a>
<li>

After the patch the closing </li> will be correct.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33183: Error inserting matchpoint_components when creating record matching rules...
Kyle Hall [Thu, 9 Mar 2023 16:35:42 +0000 (11:35 -0500)]
Bug 33183: Error inserting matchpoint_components when creating record matching rules with MariaDB 10.6

The word "offset" is now a keyword. At the very least we need to escape the fieldname with backticks.
It would be nice to switch to Koha::Objects for this module eventually.

C4::Matcher::_store_matchpoint(): DBI Exception: DBD::mysql::st execute failed: You have an error in
your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax
to use near 'offset, length) VALUES ('27', '1', '999'...' at line 2 at /usr/share/koha/lib/C4/Matcher.pm
line 314

Test Plan:
1) Set up Koha with MariaDB 10.6
2) Attempt to create a matching rule
3) Note the error screen
4) Apply this patch
5) Restart all the things!
6) Attempt to create another matching rule
7) No errors this time

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32713: Throw exception on unexpected x-koha-embed header
Martin Renvoize [Wed, 1 Mar 2023 16:42:30 +0000 (16:42 +0000)]
Bug 32713: Throw exception on unexpected x-koha-embed header

This patch adds an exception to stash_embed that is thrown when we
find an x-koha-embed header that we're not expecting.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32713: Unit tests
Martin Renvoize [Thu, 2 Mar 2023 09:37:14 +0000 (09:37 +0000)]
Bug 32713: Unit tests

This patch adds unit tests to prove we return a 400 and an appropriate
error message when calling an endpoint that is not defined to support
x-koha-embed whilst passing an x-koha-embed header.

Test plan:
1) Run test prior to applying second patch and confirm it fails
2) Run test after applying second patch and confirm it passes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32878: (follow-up) Exclude non_priority holds
Martin Renvoize [Wed, 15 Mar 2023 15:24:32 +0000 (15:24 +0000)]
Bug 32878: (follow-up) Exclude non_priority holds

This patch filters out non_priorty holds in the on_reserve condition.

Test plan
1) Run t/db_dependant/Holds.t
2) Note it fails without this patch
3) Apply patch
4) Re-run the above test, note it now passes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: (follow-up) Add INSERT IGNORE in dbrev
Marcel de Rooy [Tue, 14 Mar 2023 12:30:32 +0000 (12:30 +0000)]
Bug 32057: (follow-up) Add INSERT IGNORE in dbrev

Preventing:
ERROR - {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Duplicate entry 'ActionLogsTraceDepth' for key 'PRIMARY' at /usr/share/koha/C4/Installer.pm line 739

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32878: (QA follow-up) Correct unit test
Nick Clemens [Thu, 16 Feb 2023 16:11:23 +0000 (16:11 +0000)]
Bug 32878: (QA follow-up) Correct unit test

After the patch we fail on renewing a not for loan item with an item
level hold.

I don't find justification for why this should be renewable, so I just
change the test expectation

This needs another QA eye

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32878: Make it impossible to renew the item if it has active item level hold
Petro Vashchuk [Fri, 3 Feb 2023 14:22:30 +0000 (16:22 +0200)]
Bug 32878: Make it impossible to renew the item if it has active item level hold

introduced in:
73c3c5d2f10751c23156372300239d42e5957c66
Bug 31112: (QA follow-up) Reduce database queries

started from:
8ba1a9a5345310c54d9225049d470544b56eeb11
Bug 31112: Remove unnecessary if-clause

Currently, you can renew the item even if someone already made an item level
hold on that item. This patch changes that, making it not possible to do so.

To reproduce:
1. Checkout an item, and make another item level hold on that specific item.
2. Renew it using the "Renew" checkbox, it should get renewed without any problems.
3. Apply the patch.
4. Checkbox should be gone and replaced with "On Hold" link that leads to the hold that doesn't allow you to renew the item again.
5. "Renew all" button should not work either.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32878: (QA follow-up) Unit test
Nick Clemens [Thu, 16 Feb 2023 15:26:07 +0000 (15:26 +0000)]
Bug 32878: (QA follow-up) Unit test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32421: Add collection column to holds to pull
Lucas Gass [Wed, 7 Dec 2022 18:41:26 +0000 (18:41 +0000)]
Bug 32421: Add collection column to holds to pull

To test:

1. Place some holds
2. Go to Circulation > Holds to pull
3. Notice there is not column to indicate collection ( CCODE )
4. Apply patch and restart services
5. Step 2 again, this time you should see a column for holds to pull
6. Using both the Columns button and via 'Table setting' attempt to hide the column and other columns. Ensure everything is being heiiden correctly.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Bug 32421: (follow-up) Correct table settings

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: DBRev 22.12.00.013
Tomas Cohen Arazi [Tue, 14 Mar 2023 11:58:37 +0000 (08:58 -0300)]
Bug 32057: DBRev 22.12.00.013

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: (QA follow-up) Add missing messages (from skeleton.pl)
Tomas Cohen Arazi [Tue, 14 Mar 2023 11:48:06 +0000 (08:48 -0300)]
Bug 32057: (QA follow-up) Add missing messages (from skeleton.pl)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: DBIC schema
Tomas Cohen Arazi [Tue, 14 Mar 2023 11:43:46 +0000 (08:43 -0300)]
Bug 32057: DBIC schema

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: (QA follow-up) Add a simple test
Marcel de Rooy [Wed, 22 Feb 2023 13:53:35 +0000 (13:53 +0000)]
Bug 32057: (QA follow-up) Add a simple test

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: (QA follow-up) Remove pretty flag
Marcel de Rooy [Wed, 22 Feb 2023 13:50:10 +0000 (13:50 +0000)]
Bug 32057: (QA follow-up) Remove pretty flag

Not needed for storage. You can always display pretty in the
interface (on a follow-up report).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: Replace insert query with use of Koha::ActionLogs
Kyle Hall [Tue, 20 Dec 2022 14:21:34 +0000 (09:21 -0500)]
Bug 32057: Replace insert query with use of Koha::ActionLogs

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32057: Add optional stack trace to action logs
Kyle Hall [Tue, 1 Nov 2022 10:47:35 +0000 (06:47 -0400)]
Bug 32057: Add optional stack trace to action logs

It can be useful to know where in Koha a particular logged action was generated from, and how. We should add the ability to attach a syspref controlled basic stack trace with the caller depth controlled via the syspref. We can the call caller() until the specified depth has been reached.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
4) Restart all the things!
5) Set the new syspref ActionLogsTraceDepth to a number ( e.g. 3 )
6) Update a syspref or trigger another enabled log action
7) Query the database: SELECT * FROM action_logs WHERE trace IS NOT NULL
8) Note the stack trace was created!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 29354: Make overdue_notices.pl send .html
Magnus Enger [Mon, 12 Dec 2022 13:41:20 +0000 (13:41 +0000)]
Bug 29354: Make overdue_notices.pl send .html

If you have EmailOverduesNoEmail = Send and specify "--html somedir",
overdue_notices.pl will send a file by email that contains partial
HTML, as a file called attachment.txt. This patch fixes that.

To reproduce in koha-testing-docker:
- EmailOverduesNoEmail = Send
- Make sure you have a loan that was due yesterday, by backdating the
  due date
- Set up an overdue action to send "Overdue Notice" (ODUE) to the
  category you made the loan to above, when a loan is one day overdue
- Run this command:
  $ sudo koha-shell -c "perl misc/cronjobs/overdue_notices.pl -v -t -html /tmp/" kohadev
- Look at the file /tmp/notices-<DATE>.html and make sure it is a full
  HTML document, with <html>, <head>, <body> etc.
- Create a report like this:
  SELECT message_id, letter_id, borrowernumber, subject, CONCAT( '<pre>', content, '</pre>' ) AS content,
    metadata, letter_code, message_transport_type, time_queued, updated_on, to_address, content_type, failure_code
  FROM message_queue
  WHERE subject = 'Overdue Notices'
  ORDER BY message_id DESC
- Run the report and verify there is a line like this in the "content"
  of the newest message:
  Content-Type: text/plain; name=attachment.txt
- A part of the "content" will be a block of several lines of gibberish
  (base64) that look something like "RGVhciAga29oYSwNCg0KQWN...". Copy
  this block of text to somewhere like base64decode.org and decode the
  text. You should see a fragment of HTML, without <html>, <head>,
  <body> etc.

To test:
- Apply the patch
- Run overdue_notices.pl again, with the same arguments as above
- Make sure /tmp/notices-<DATE>.html is still a full HTML document
- Re-run the report, and make sure you now have this in the "content":
  Content-Type: text/html; name=attachment.html
- Decode the base64 and make sure it is now a full HTML document, with
  <html>, <head>, <body> etc.
- Re-run overdue_notices.pl as above, but replace "-html /tmp/" with
  "-csv /tmp/test.csv"
- Make sure /tmp/test.csv and the decoded base64 from the report
  contains CSV data
- Re-run overdue_notices.pl as above, but replace "-html /tmp/" with
  "-text /tmp/"
- Make sure /tmp/notices-<DATE>.txt and the decoded base64 from the
  report contains no HTML

Note:
- The actual text from the different messages will be enclosed in
  <pre>-tags
- If you have HTML in your ODUE message template and run with -v, you
  will have warnings saying "The following terms were not matched and
  replaced"
These are due to Bug 14347, and are not adressed by the current patch.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33150: Add specific message for informing about too_soon for renewal.
Andreas Jonsson [Mon, 6 Mar 2023 15:42:05 +0000 (16:42 +0100)]
Bug 33150: Add specific message for informing about too_soon for renewal.

The message "No renewals allowed" is incorrect when it is too soon for renewal,
this patch adds a specific error message.

To test:
- Make sure the system preference  SCOAllowCheckin is set to "allow"
- Go to Koha administration -> Circulation and fine rules
- Edit the rule for all items and change "No renewal before" to 1 and save.
- Check out an item to a borrower (for instance barcode 39999000000719 to the user koha with cardnumber 42).
- Go to self checkout (http://localhost:8080/cgi-bin/koha/sco/sco-main.pl)
- Log in as the user (koha/koha)
- Verify that the error message in the Renew column is "This item cannot yet be renewed."

Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32684: (QA follow-up) Move too_many_lost to Patron
Marcel de Rooy [Wed, 8 Mar 2023 12:45:53 +0000 (12:45 +0000)]
Bug 32684: (QA follow-up) Move too_many_lost to Patron

Alternative implementation outside sub new.

Test plan:
Run t/db_dependent/SIP/Message.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32684: Implement SIP patron status field "too many items lost"
Kyle Hall [Thu, 19 Jan 2023 18:45:07 +0000 (13:45 -0500)]
Bug 32684: Implement SIP patron status field "too many items lost"

The SIP patron status and information responses always return false foe "too many items lost". It would be reasonable to check the count of lost items still checked out to the patron and compare that to a threshold set in the sip config file. Though not all libraries operate in this way, it seems like a good and reasonable implementation as long is it is properly documented.

This patch adds the ability to set the SIP "too many items lost" flag
for a patron based on the number of lost checkouts the patron has where
the lost flag on those items is greater than the given flag value.

For example, one could specify that the flag be set if the patron has
more than 2 items checked out where itemlost is greater than 3.

By default the feature is disabled to retain the existing functionality.
If enabled, the default itemlost minimum flag value is 1 unless
specified.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/SIP/Message.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33144: Unescape text from authority lookup for advanced editor
Phil Ringnalda [Mon, 6 Mar 2023 05:24:56 +0000 (21:24 -0800)]
Bug 33144: Unescape text from authority lookup for advanced editor

While the basic editor is happy with an array of subfields it can
stuff into separate fields, the advanced editor needs to get a JS
string back from the authority lookup plugin, because it is going
to just add the whole thing as text. The string has to be HTML
entity encoded, both to not allow XSS and just to not break the
window, but it needs to then be unencoded before being inserted
into the editor.

Test plan:
1. Set the system preference EnableAdvancedCatalogingEditor to
   Enable
2. Edit any Topical Term authority, and at the end of tag 150
   subfield a, add & </script>
3. Cataloging - Advanced editor
4. Press return in the editor to get a new blank line, type 650
   and press tab three times, then type Ctrl-Shift-L
5. Search for your modified authority, and click Choose
6. Verify that the tiny popup opened by the search window finished
   its job and closed itself
7. Verify that your 650 now shows as "‡aAbduction &
   </script>‡vDrama" rather than "‡aAbduction  &amp;
   &lt;/script&gt;‡vDrama."

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32118: Add optional support for `:` as the modifier
Martin Renvoize [Thu, 3 Nov 2022 11:02:21 +0000 (11:02 +0000)]
Bug 32118: Add optional support for `:` as the modifier

This patch adds optional support for using `:` as the modifier for
invoking the 'count' method for relations as discussed.

We retain support for `+` for backward compatability to prevent a
breaking change.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33214: (follow-up) Make tests less fragile
Tomas Cohen Arazi [Mon, 13 Mar 2023 19:53:25 +0000 (16:53 -0300)]
Bug 33214: (follow-up) Make tests less fragile

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33214: (follow-up) Consistency on key names
Tomas Cohen Arazi [Mon, 13 Mar 2023 19:42:26 +0000 (16:42 -0300)]
Bug 33214: (follow-up) Consistency on key names

This patch makes GetAuthorisedValueDesc used cache keys match what we
discussed on the bug, which seems to have been lost on some rebase and
highlighted by failing tests.

I also add some more cache flushes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32781: Prevent import from list to fail if package does not exist
Jonathan Druart [Wed, 1 Feb 2023 15:23:59 +0000 (16:23 +0100)]
Bug 32781: Prevent import from list to fail if package does not exist

This is theorical (caught when writting tests) but we need to deal with
it.

Can't call method "resources" on an undefined value at /kohadevbox/koha/Koha/BackgroundJob/CreateEHoldingsFromBiblios.pm line 94.

Test plan:
  prove t/db_dependent/Koha/BackgroundJob/CreateEHoldingsFromBiblios.t
must return green

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30943: Fix test
Jonathan Druart [Wed, 1 Feb 2023 15:17:57 +0000 (16:17 +0100)]
Bug 30943: Fix test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30943: Adjust CreateEHoldingsFromBiblios
Jonathan Druart [Wed, 1 Feb 2023 15:15:11 +0000 (16:15 +0100)]
Bug 30943: Adjust CreateEHoldingsFromBiblios

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30943: Simplify background jobs code using helpers
Tomas Cohen Arazi [Thu, 8 Sep 2022 00:35:09 +0000 (17:35 -0700)]
Bug 30943: Simplify background jobs code using helpers

This patch makes the current background jobs classes use the added
helpers in order to simplify them.

No behavior change is expected.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30624: DBRev 22.12.00.012
Tomas Cohen Arazi [Mon, 13 Mar 2023 18:40:32 +0000 (15:40 -0300)]
Bug 30624: DBRev 22.12.00.012

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30624: Make DB update idempotent
Lucas Gass [Mon, 13 Mar 2023 12:17:32 +0000 (12:17 +0000)]
Bug 30624: Make DB update idempotent

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30624: (QA follow-up) Use C4:Context to get permissions
Lucas Gass [Tue, 28 Feb 2023 17:04:52 +0000 (17:04 +0000)]
Bug 30624: (QA follow-up) Use C4:Context to get permissions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30624: Adjust number of tests
Lucas Gass [Tue, 24 Jan 2023 16:50:39 +0000 (16:50 +0000)]
Bug 30624: Adjust number of tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30624: Unit tests
Lucas Gass [Wed, 14 Dec 2022 21:53:18 +0000 (21:53 +0000)]
Bug 30624: Unit tests

Signed-off by: Bob Bennhoff/AspenCat Team

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30624: Add loggedinlibrary permission and DB update
Lucas Gass [Tue, 13 Dec 2022 20:59:50 +0000 (20:59 +0000)]
Bug 30624: Add loggedinlibrary permission and DB update

To test:
1. Apply patch, updatedatabase, restart_all
2. Have a user with superlibrarian privileges ( User1 )
3. Have a user who has staff access and circulate privileges but is not a super librarian. ( User2 ) Make note of this users home library
4. Turn on the system preference 'CircSidebar'.

-MAIN log in ( auth.tt )
5. As User1, go to the main login screen and try logging in. You should be able to log in AND you should be able to properly chnage your branch BEFORE logging in.
6. As User2, to to the main login screnn amd try logging in. You should be able to but if you try and switch your libraray to anything beside the user's home branch it will not work. You will be logged in at your home branch.
7. For User2, set the new top level permission 'Allow staff to change logged in library (loggedinlibrary).
8. Now you should be able to successfully switch libraries before log in.
9. Turn the 'loggedinlibrary' permission back off for User2.

-AFTER log in-
10. With User1, click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
11. With User2, click on your name/branch in the top right. If you have 'UseCirculationDesks' on, you should see 'Set desk', otherwise you should see nothing.
12. Repeat step 7.
13. NOw if you click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
14. Repeat Step 9.

-CircSideBar-
15. With 'CircSideBar' turned on, go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup) with User1. You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
16. Try with User2 and you will not see a 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set desk' link.
17. Repeat step 7.
18. For with User2 you go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup). You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
19. Repeat step 9.

-Set library page-
20. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User1. You will see a dropdown for 'Set library'. Make sure you can change your library successfully.
21. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. You should NOT see see a dropdown for 'Set library'.
22. Repeat step 7.
23. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. Now you should see a dropdown for 'Set library'.

Signed-off by: Bob Bennhoff/AspenCat Team

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33214: Make tests use random data and clear the cache
Tomas Cohen Arazi [Mon, 13 Mar 2023 17:29:18 +0000 (14:29 -0300)]
Bug 33214: Make tests use random data and clear the cache

This trivial patch removes some wrongly hardcoded bits, and makes the
tests also clear the cache before and after being run.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32734: (QA follow-up) Make use of $c->objects->to_api
Tomas Cohen Arazi [Mon, 13 Mar 2023 18:06:44 +0000 (15:06 -0300)]
Bug 32734: (QA follow-up) Make use of $c->objects->to_api

This is using plain `$biblios->to_api` but as of bug 33080, the new
helper should be used instead. This patch fixes that.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32734: (QA follow-up) Remove stray method
Tomas Cohen Arazi [Mon, 13 Mar 2023 17:58:21 +0000 (14:58 -0300)]
Bug 32734: (QA follow-up) Remove stray method

On bug 33083 we introduce a better way to implement a reusable method
for the same functionality.

This patch just removes the one in `Koha::Biblios` and the result should
be the same as the one inherited from  `Koha::Objects::Record::Collections` will be picked instead.

To test:
1. Run:
   $ prove t/db_dependent/Koha/Biblios.t \
           t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 32734: Add REST endpoint to list biblios
Agustin Moyano [Fri, 17 Feb 2023 01:17:43 +0000 (22:17 -0300)]
Bug 32734: Add REST endpoint to list biblios

This patch adds an endpoint to list biblios

To test:
1. apply patch
2. enable basic auth
3. call to GET /api/v1/biblios with the following Accept headers:
 * application/json
 * application/marcxml+xml
 * application/marc-in-json
 * application/marc
 * text/plain
4. notice how data changes with each Accept header
5. prove t/db_dependent/Koha/Biblios.t t/db_dependent/api/v1/biblios.t
6. sign off

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 33083: Add a generic class to handle methods for collections of records
Agustin Moyano [Mon, 27 Feb 2023 22:10:31 +0000 (19:10 -0300)]
Bug 33083: Add a generic class to handle methods for collections of records

To test:
1. Apply patch
2. prove t/db_dependent/Koha/Objects/Record/Collections.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30920: (follow-up) Manually flush caches in tests
Martin Renvoize [Fri, 10 Mar 2023 16:34:26 +0000 (16:34 +0000)]
Bug 30920: (follow-up) Manually flush caches in tests

We can't rely on our cache flushing in either 'store' or 'delete'
triggers as t/lib/TestBuilder::build_object skips the Koha::Object store
and uses direct DB inserts in preference.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30920: (follow-up) Cleanup warning from C4::Biblio::GetAuthorisedValueDesc
Martin Renvoize [Fri, 10 Mar 2023 16:33:44 +0000 (16:33 +0000)]
Bug 30920: (follow-up) Cleanup warning from C4::Biblio::GetAuthorisedValueDesc

We simply return early and empty if $value is not passed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30920: (follow-up) Flush on delete
Martin Renvoize [Fri, 10 Mar 2023 15:26:45 +0000 (15:26 +0000)]
Bug 30920: (follow-up) Flush on delete

We missed the flush on delete triggers for the various caches introduced
here.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30920: (follow-up) Cache key fixes
Martin Renvoize [Fri, 10 Mar 2023 15:11:51 +0000 (15:11 +0000)]
Bug 30920: (follow-up) Cache key fixes

We missed a few places, namely the flushes, when renaming the cache
keys.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
15 months agoBug 30920: (QA follow-up) Use get_dirty_columns to avoid DB query
Tomas Cohen Arazi [Fri, 10 Mar 2023 12:07:26 +0000 (09:07 -0300)]
Bug 30920: (QA follow-up) Use get_dirty_columns to avoid DB query

We can rely on DBIC's get_dirty_columns to check if the descriptions
have changed, and set things for flushing without an extra DB query.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>