koha.git
2 years agoBug 27847: Compiled CSS changes
Kyle M Hall [Fri, 13 Aug 2021 11:57:25 +0000 (07:57 -0400)]
Bug 27847: Compiled CSS changes

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27847: Don't obscure page when checkin modal is non-blocking
Owen Leonard [Mon, 19 Apr 2021 11:49:25 +0000 (11:49 +0000)]
Bug 27847: Don't obscure page when checkin modal is non-blocking

This patch changes the series of events striggered when a non-blocking
modal dialog is displayed during checkin. If the "TransfersBlockCirc"
preference is set to "Don't block," the user can continue to check in
even though a transfer dialog has appeared. This patch hides the modal's
"backdrop" element so that the modal doesn't look like one which blocks
further action.

There is no Bootstrap backdrop option which both hides the backdrop and
makes it non-blocking, so we have to use the default non-blocking option
and "manually" hide the backdrop.

The "show.bs.modal" event must be added in order to make the
necessary change before the modal is displayed. This prevents the
darkened backdrop from appearing and then being hidden.

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

- Set the "TransfersBlockCirc" preference to "Don't block."
- Check in an item which belongs to another library.
- A modal dialog should be displayed: "Please return this item to XXX"
- The page "behind" the modal should not be darkened, and the cursor
  focus should remain in the check-in field.
- Checking in an item which as a hold should still trigger the
  "blocking" behavior: The modal must be dismissed by clicking one of
  its buttons (not the backdrop) and the page behind the modal should be
  darkend.
- Test with "TransfersBlockCirc" set to "Block." Checking in an item
  belonging to another library should trigger the "blocking" modal
  behavior.
- Test that other checkins still work correctly.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28764: (QA follow-up) Add comment, remove two defined's
Marcel de Rooy [Mon, 9 Aug 2021 13:41:45 +0000 (13:41 +0000)]
Bug 28764: (QA follow-up) Add comment, remove two defined's

If we no longer offer the sortfield with :asc actively, we should
probably write it somewhere too.
Replaced a few defined tests by empty test. No need to split empty
string or zero etc.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28764: Alter sort dropdown to use direction parameter
Nick Clemens [Fri, 30 Jul 2021 10:54:47 +0000 (10:54 +0000)]
Bug 28764: Alter sort dropdown to use direction parameter

This code is odd -we build a select in the template, then turn it into a list of links using javascript
This patch adds a direction data element and uses it while building the links

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28764: Parse direction parameter in public list view
Nick Clemens [Tue, 27 Jul 2021 11:27:21 +0000 (11:27 +0000)]
Bug 28764: Parse direction parameter in public list view

This patch adds a check for a 'direction' paramter in list sorting.

It maintains the existing syntax for sorting 'sortfield=field:direction'
but adds support for the form used in paginations and more commonly thtoughout
Koha' sortfield=field&direction=direction'

To test:
1 - Create a public list
2 - Add enough items to generate two pages (40 worked for me)
3 - View the list and enforce sorting by date added descending:
    sortfield=dateadded:desc
4 - Note the titles shown
5 - Click to second page using the pagination bar
6 - Note the same titles are shown, in a reversed order
7 - Apply patch
8 - repeat 305
9 - Second page is sorted correctly!

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: DBRev 21.05.02.002
Kyle M Hall [Fri, 13 Aug 2021 11:44:34 +0000 (07:44 -0400)]
Bug 28813: DBRev 21.05.02.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: Rename delivery_note to failure_code
Martin Renvoize [Thu, 5 Aug 2021 09:17:29 +0000 (10:17 +0100)]
Bug 28813: Rename delivery_note to failure_code

We now use the codes from the half implimented error_code in place of
the plain text that was being added to the delivery_note field. As part
of that we rename the field to failure_code to clarify it's intended
content.

Test plan
1/ Confirm t/db_dependent/Letters.t passes

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: Update unit tests
Martin Renvoize [Thu, 5 Aug 2021 09:16:24 +0000 (10:16 +0100)]
Bug 28813: Update unit tests

This patch updates the unit tests to check for failure_code instead of
delivery_note and catches a missing case.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: DBIC Schema Update
Martin Renvoize [Thu, 5 Aug 2021 09:15:58 +0000 (10:15 +0100)]
Bug 28813: DBIC Schema Update

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: Update database field name
Martin Renvoize [Thu, 5 Aug 2021 09:14:49 +0000 (10:14 +0100)]
Bug 28813: Update database field name

Update the database field name from 'delivery_note' to 'failure_code' to
more accurately denote it's use.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28835: Fix ability to pass list contents to batch record modification
Fridolin Somers [Tue, 10 Aug 2021 09:14:03 +0000 (23:14 -1000)]
Bug 28835: Fix ability to pass list contents to batch record modification

Bug 12759 added the ability to pass list contents to batch record
modification/deletion tools.
Patch Bug 22417 [Restore the 'add to list' feature] removed the fetch
of lists in batch_record_modification.pl I don't understand why.
It still exists in batch_delete_records.pl.

Note that this is needed when first form is displayed.

Test plan :
1) Create a private and a public list of records
2) Open Tools > Batch record modification
3) Check you can use the lists
4) Open Tools > Batch record deletion
5) Check you can use the lists

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders
Nick Clemens [Mon, 9 Aug 2021 12:09:13 +0000 (12:09 +0000)]
Bug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders

Find closest ul for value builders.

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript
code does not do its job anymore.
This is because a div is added and this call is now wrong:
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');

Test plan 1:
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value

Test plan 2:
1) Use a MARC_21 DB
2) Define plugin marc21_linking_section.pl on 773$t
3) Make sure 773$t and other subfields are visible in intranet/editor
4) Create a new record in basic cataloging editor
5) Click on value builder in 773$t
6) Search fro a record
7) Click on "Choose"
=> Without patch fields are not fileld
=> With patch subfields are correctly filled

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28569: In opac-suggestions.pl preselect user library
Fridolin Somers [Wed, 16 Jun 2021 09:17:19 +0000 (11:17 +0200)]
Bug 28569: In opac-suggestions.pl preselect user library

In OPAC new purchase suggestion opac-suggestions.pl for library combobox :
actually first value is selected, user library should be selected.

Test plan :
1) Create a new library named 'ZZZ top'
2) Set this library on a user U1
2) Loggin at OPAC with user U1
3) Create a new suggestion
=> Check library 'ZZZ top' is preselected

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28727: (QA follow-up) Simplify permission check
Katrin Fischer [Tue, 10 Aug 2021 23:04:49 +0000 (01:04 +0200)]
Bug 28727: (QA follow-up) Simplify permission check

There was another permission check for edit_items directly below,
so instead of changing them to both be edit_items, I think we
can now remove one.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28727: Show edit item link when user has edit items permission
Andrew Fuerste-Henry [Tue, 20 Jul 2021 19:42:41 +0000 (19:42 +0000)]
Bug 28727: Show edit item link when user has edit items permission

To test:
1: log in as a user with edit_items but not edit_catalogue
2: confirm you do not get an Edit Item link on moredetail.pl
3: apply patch, restart, reload
4: confirm link now shows

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28804: (bug 25026 follow-up) Handle SQL errors in reports
Jonathan Druart [Wed, 4 Aug 2021 06:59:40 +0000 (08:59 +0200)]
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports

Since bug 25026 DBMS errors are raised, but the report module is not
dealing correctly with the errors.
If an error occurred in execute_query, next queries will fail as well,
we should skip them.

Test plan:
1. Create report from SQL queries, containing errors (invalid syntax, etc.)
'SELECT id FROM borrowers' can do it
2. Execute the query
=> Without this patch you get a 500
=> With this patch applied you see that the error raised at DBMS level
is propagated to the UI
3. Confirm that there is no regression on valid queries

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoRevert "Bug 28833: Speed up holds queue builder via parallel processing"
Kyle M Hall [Wed, 11 Aug 2021 13:21:11 +0000 (09:21 -0400)]
Revert "Bug 28833: Speed up holds queue builder via parallel processing"

This reverts commit 08ad241ab510350d44673376c28d853a328a4ec5.

2 years agoBug 28833: Speed up holds queue builder via parallel processing
Kyle M Hall [Mon, 9 Aug 2021 17:46:00 +0000 (13:46 -0400)]
Bug 28833: Speed up holds queue builder via parallel processing

The holds queue builder can take a very long time to run on systems with many holds. For example, a partner with 124,784 unfilled ( not found ) holds, is taking about 64 minutes to run. If we run that same number of holds in 5 parallel chunks ( splitting the number of records as evenly as possible, but *not* taking into account the holds per bib ), it takes 21.5 minutes. If we use 10 loops, it takes less then 14 minutes.

Test Plan:
1) Generate a huge number of holds ( a few thousand at the minimum )
2) Run the holds queue builder, use the `time` utility to track how much
   time it took to run
3) Set HoldsQueueParallelLoopsCount to 10
4) Repeat step 2, note the improvement in speed
5) Experiment with other values for HoldsQueueParallelLoopsCount
6) prove t/db_dependent/HoldsQueue.t

2 years agoBug 28630: Improve date comparisons in tests
Jonathan Druart [Wed, 4 Aug 2021 09:12:41 +0000 (11:12 +0200)]
Bug 28630: Improve date comparisons in tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28630: (follow-up) Update wording of syspref
Martin Renvoize [Mon, 28 Jun 2021 13:42:13 +0000 (14:42 +0100)]
Bug 28630: (follow-up) Update wording of syspref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28630: Add unit tests
Martin Renvoize [Fri, 25 Jun 2021 09:33:18 +0000 (10:33 +0100)]
Bug 28630: Add unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28630: Add track_login_daily to ILSDI::AuthenticatePatron
Martin Renvoize [Fri, 25 Jun 2021 08:50:50 +0000 (09:50 +0100)]
Bug 28630: Add track_login_daily to ILSDI::AuthenticatePatron

This patch adds a call to track_login_daily for the AuthenticatePatron
method in ILSDI.

Many libraries use this ILSDI endpoint for electron book borrowing and
need to maintain the lastseen based on this type of lending.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28773: (QA follow-up) Additional changes
Marcel de Rooy [Fri, 30 Jul 2021 08:51:24 +0000 (08:51 +0000)]
Bug 28773: (QA follow-up) Additional changes

The work of the first patch was not yet finished.

[1] Similar changes to template for Cataloging and Authorities
[2] Made a better distinction now between short title on button
    and long title on menu and modal
[3] The short title parameter removes need for previewed var
[4] To keep related code closer, moved the dataPreview hidden 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: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28773: (bug 23302 follow-up) Fix add order from z3950 search results
Jonathan Druart [Wed, 28 Jul 2021 10:04:43 +0000 (12:04 +0200)]
Bug 28773: (bug 23302 follow-up) Fix add order from z3950 search results

For translated interface.

Using 'Order' (the button text) was not a good idea as the interface can
be translated :)

Signed-off-by: Mark Hofstetter <koha@trust-box.at>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28754: Only adjust holds on specific biblio and don't go past end of array
Nick Clemens [Fri, 23 Jul 2021 17:56:39 +0000 (17:56 +0000)]
Bug 28754: Only adjust holds on specific biblio and don't go past end of array

Our query for lowest priority holds only needs to adjust holds on the biblio we are looking at
so I add biblionumber

Additionally we can simply find the end of the array and use that rather than 99998
so I set new_rank to scalar @priority

Lastly, we don't need to fetch the lowest priority holds if we are ignoring lowest priority
so I move it into the conditional

To test:
 1 - Add holds with lowest priorty to 2 records in the catalog
 2 - Add a hold on a third record
 3 - Note errors in log like:
    [2021/07/23 17:47:17] [WARN] splice() offset past end of array at /kohadevbox/koha/C4/Reserves.pm line 1649
 4 - Apply patch and restart all the things
 5 - Add a new hold on third record - no warns
 6 - Make one of the holds on third record have lowestPriority (click rightmost arrow with line at bottom)
 7 - Note no warns
 8 - Adjust other holds on record and note no warns

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28741: (follow-up) Silence warning
Tomas Cohen Arazi [Mon, 2 Aug 2021 13:04:01 +0000 (10:04 -0300)]
Bug 28741: (follow-up) Silence warning

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28741: Fix use of resumption token params
Nick Clemens [Thu, 22 Jul 2021 17:56:39 +0000 (17:56 +0000)]
Bug 28741: Fix use of resumption token params

TO test:
 1 - Enable OAI-PMH server in Koha
 2 - Set OAI-PMH:MaxCount to 5
 3 - Define 6 sets in Admin->OAI sets configuration
    Can setSpec and setName to 1,2,3....
 4 - Browse to:
    http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListSets
 5 - Click 'Show more'
 6 - Keep seeing the same 5 - note the page says 'Results fetched -4-0'
 7 - Apply patch
 8 - Restart all the things
 9 - Reload the ListSets URL above
10 - Click 'Show more'
11 - See the 6th set and note no 'Show more'
12 - Set OAI-PMH:MaxCount to 1
13 - Go to the base ListSets url again
14 - Confirm you can 'Show more' until you reach the end

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28741: Regression tests
Tomas Cohen Arazi [Fri, 30 Jul 2021 17:53:31 +0000 (14:53 -0300)]
Bug 28741: Regression tests

This patch adds regression tests for the behavior.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28533: Fix other ocurrence
Nick Clemens [Fri, 30 Jul 2021 19:20:29 +0000 (19:20 +0000)]
Bug 28533: Fix other ocurrence

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28533: Set subfields to 'undef' if whole field request in itemcallnumebr system...
Nick Clemens [Wed, 9 Jun 2021 12:59:27 +0000 (12:59 +0000)]
Bug 28533: Set subfields to 'undef' if whole field request in itemcallnumebr system preference

This patch undefines the CNsubfields variable when the whole field is requested

Note that the substr returns '' when no characters are found, so we test if the string eq ''

Testing 'truth' doesn't work because "0" is a valid option

To test:
 1 - Edit a record, add an 082 field
     082 0 0 ‡aalpha‡bbeta‡0delta
 2 - Set itemcallnumber system preference to 082
 3 - Attempt to add/edit items
 4 - ISE
 5 - Apply patch, restart all the things
 6 - Add/edit items - no error
 7 - Confirm the itemcallnumber field is populated with "alpha beta delta"
 8 - Set itemcallnumber system preference to '0820'
 9 - Add/edit items
10 - Confirm itemcallnumber is populated with 'delta'

Signed-off-by: Salman Ali <salman.ali@inLibro.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28057: (follow-up) Get the biblionumber column
Nick Clemens [Wed, 28 Jul 2021 17:37:46 +0000 (17:37 +0000)]
Bug 28057: (follow-up) Get the biblionumber column

When we fetch the biblioitems we use a select to limit the columns fetched,
we must include the biblionumber as well

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28057: Use the biblioitem's biblionumber for checking availability
Nick Clemens [Wed, 14 Apr 2021 18:19:40 +0000 (18:19 +0000)]
Bug 28057: Use the biblioitem's biblionumber for checking availability

The loop here gets items from the record, plus analytic items. Because of this
we need to check more than 1 record - we decide to do this via biblioitems.

We need to preserve that, but when checking ItemsAnyAvailableAndNotRestricted we
cannot assume that the biblionumber and biblioitemnumber are the same (they should be
but this may not be the best of all possible worlds)

I simply switch the call here

To test:
1 - Apply patch
2 - Test placing holds on single bibs and multiple bibs
3 - Confirm it works as expected

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28704: Library MARCOrgCode field needs maxlength attribute
Owen Leonard [Tue, 13 Jul 2021 10:54:59 +0000 (10:54 +0000)]
Bug 28704: Library MARCOrgCode field needs maxlength attribute

This patch adds a maxlength attribute to the "MARC organization code"
field in the form for adding and editing libraries. The maxlength, 16,
matches the limit of the table column.

To reproduce the problem, go to Administration -> Libraries.
 - Add or edit a library
 - Fill the "MARC organization code" field with a string longer than 16
   characters, e.g. Decriminalization
 - When you save the record you will see an error.

Apply the patch and add or edit a library.
 - Confirm that you cannot enter more than 16 characters in the "MARC
   organization code" field.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28728: Link to holds page from holds raio
Andrew Fuerste-Henry [Wed, 21 Jul 2021 12:37:21 +0000 (12:37 +0000)]
Bug 28728: Link to holds page from holds raio

To test:
1 - Find a bib with 1 item, place 3 bib-level holds on it (just to make
    sure there's at least one title on your holds ratio page)
2 - Go to the holds ratio page in circulation
3 - mouse over the Holds Ratio column, see that the number there is a
    link to http://[your koha]/cgi-bin/koha/circ/reserveratios.pl#, the
    page you're already on
4 - apply patch, restart_all, reload page
5 - link now goes to the holds page for that title

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28733: Correct position of desks link in admin menu
Owen Leonard [Thu, 22 Jul 2021 18:35:13 +0000 (18:35 +0000)]
Bug 28733: Correct position of desks link in admin menu

This patch moves the "Desks" link from the "Basic parameters" section to
the "Patrons and circulation" section, matching the category of the link
on the Administration home page.

To test, apply the patch and go to an administration page which includes
the left-hand navigation sidebar, e.g. Administration -> Libraries.

In the sidebar, the "Desks" link should be in the "Patrons and
circulation" section, under "Item circulation alterts," matching its
position on the Administration home page.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 28733: (follow-up) Add manage_libraries permission check

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28689: Extra %s in alert message when saving an items
Owen Leonard [Thu, 15 Jul 2021 13:00:14 +0000 (13:00 +0000)]
Bug 28689: Extra %s in alert message when saving an items

This patch removes an unnecessary %s in the text built to show when
there are errors in the cataloging add item form.

To reproduce, open the add item form in cataloging and click "Add item"
without filling in all mandatory fields. You should see an alert message
that contains, "- %s 1 mandatory fields empty (highlighted)"

To test, apply the patch and return to the add item form. Now when you
save an incomplete form the message should omit the %s:

- 1 mandatory fields empty (highlighted)

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28567: DBRev 21.06.00.011
Jonathan Druart [Fri, 30 Jul 2021 14:07:09 +0000 (14:07 +0000)]
Bug 28567: DBRev 21.06.00.011

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28567: Fix 0 vs "" vs undef on the admin library form
Jonathan Druart [Fri, 25 Jun 2021 10:44:19 +0000 (12:44 +0200)]
Bug 28567: Fix 0 vs "" vs undef on the admin library form

There are two things here:
* Branches.pickup_location has a default = 1 in DB, we should not set to undef if 0
or it will be set to 1 when stored.
* The other fields are all text (varchar, mediumtext or longtext) and
can be NULL. They are correct set to NULL when a new library is created
but set to an empty string when the library is modified. That's not
consistent

Test plan:
0. Don't apply the patch
1. Create a new library, set pickup location to "No"
2. Save
=> Pickup location is set to YES
=> In DB notice that the different values you didn't fill in are set to
NULL
3. Edit the library
4. Save
=> In DB notice that the different values you didn't fill in are now set
to an empty string
5. Apply the patch, restart_all
6. Run the updatedatabase script
=> In DB all the empty string values are set to NULL
7. Repeat 1 to 4 and confirm that everything is now working as expected

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28509: Prevent Koha/Acquisition/Orders.t to fail randomly
Jonathan Druart [Mon, 19 Jul 2021 12:35:11 +0000 (14:35 +0200)]
Bug 28509: Prevent Koha/Acquisition/Orders.t to fail randomly

The random errors were:
03:25:39 koha_1       |     #     Structures begin differing at:
03:25:39 koha_1       |     #          $got->[0] = '10'
03:25:39 koha_1       |     #     $expected->[0] = '9'

and

16:36:15 koha_1       |     #     Structures begin differing at:
16:36:15 koha_1       |     #          $got->[0] = '100'
16:36:15 koha_1       |     #     $expected->[0] = '99'

You see it coming?

We sorted the ordernumbers alphabetically.

Test plan:
0. Don't apply this patch
1. % git checkout v21.05.01 # The error is not appearing in master right now
2. Add 2 warn statements before the 'The 2 orders are returned' tests to
display $order_1->ordernumber and $order_2->ordernumber
3. MariaDB CLI > ALTER TABLE aqorders AUTO_INCREMENT=3;
4. prove t/db_dependent/Koha/Acquisition/Orders.t
=> Fail with
    #     Structures begin differing at:
    #          $got->[0] = '10'
    #     $expected->[0] = '9'
5. Apply this patch, repeat 3. and 4.
=> The test passes now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28749: Restore the database name to Koha dumps
Jason Boyer [Wed, 28 Jul 2021 14:01:25 +0000 (14:01 +0000)]
Bug 28749: Restore the database name to Koha dumps

The line to use the --databases flag with mysqldump by default was accidentally
removed from koha-dump when the --schema-only option was added. This makes all
backups act as if koha-dump is called with the --without-db-name flag, causing
koha-restore to fail to restore the database because it's neither CREATEd or USEd.

This patch restores that line

To test:
1 - sudo debian/scripts/koha-dump kohadev
2 - zcat /var/spool/koha/kohadev/kohadev-2021-07-28.sql.gz | grep DATABASE
3 - Notice no output
4 - Apply patch
5 - sudo debian/scripts/koha-dump kohadev
6 - zcat /var/spool/koha/kohadev/kohadev-2021-07-28.sql.gz | grep DATABASE
7 - You get the line:
    CREATE DATABASE /*!32312 IF NOT EXISTS*/ `koha_kohadev` /*!40100 DEFAULT CHARACTER SET latin1 */;

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28632: Prevent api/v1/patrons.t to fail on dates comparison
Jonathan Druart [Wed, 28 Jul 2021 10:24:14 +0000 (12:24 +0200)]
Bug 28632: Prevent api/v1/patrons.t to fail on dates comparison

 #   Failed test 'Returned patron from update matches expected'
 #   at t/db_dependent/api/v1/patrons.t line 537.
 #     Structures begin differing at:
 #          $got->{updated_on} = '2021-07-27T13:33:53+00:00'
 #     $expected->{updated_on} = '2021-07-27T13:33:52+00:00'
 # Looks like you failed 1 test of 42.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28469: Move "Skip to main content" to top of OPAC page
David Cook [Thu, 27 May 2021 03:34:30 +0000 (03:34 +0000)]
Bug 28469: Move "Skip to main content" to top of OPAC page

This patch moves the "Skip to main content" button out of the nav
element and to the top of the <body> element, so that it's the first
(potentially) viewable element on the page.

This means you can inject content above the navbar, which has
a relative position, and it won't disrupt the display of the
"Skip to main content" button.

To test:
1) Apply patch
2) Same test plan as Bug 22807:
Go to any page in the OPAC and hit the tab key. The "Skip to main
content" link should appear. Tabbing away from it should cause the link
to hide. Hitting the ENTER key when the link is highlighted should cause
the page to scroll to the main content.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28662: Compiled CSS
Kyle M Hall [Fri, 30 Jul 2021 14:57:47 +0000 (10:57 -0400)]
Bug 28662: Compiled CSS

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28620: Replace remaining occurrence in test
Jonathan Druart [Mon, 26 Jul 2021 09:19:17 +0000 (11:19 +0200)]
Bug 28620: Replace remaining occurrence in test

Not useful but won't hurt either.
At least all our occurrences are identical now.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28620: Remove trailing space when logging with log4perl
Marcel de Rooy [Wed, 23 Jun 2021 11:59:21 +0000 (11:59 +0000)]
Bug 28620: Remove trailing space when logging with log4perl

Trivial change.
Do sed -i -r -e'/log4perl/ s/\s%n$/%n/' on the log4perl configs.

Test plan:
Update your own config.
Trigger some logging and check that logfile.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28662: Not possible to log out of patron account in OPAC with JavaScript disabled
Owen Leonard [Tue, 6 Jul 2021 13:07:42 +0000 (13:07 +0000)]
Bug 28662: Not possible to log out of patron account in OPAC with JavaScript disabled

This patch adds a "Log out" link to the OPAC header which is hidden by
CSS when JavaScript is enabled.

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

 - Log in to the OPAC with JavaScript disabled in your browser.
 - In the header next to the logged-in user's name there should be a
   "Log out." link.
 - Confirm that it logs the user out.
 - Enable JavaScript and repeat the process to confirm that the new
   logout link doesn't appear.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28408: Add new column to the table settings config
Jonathan Druart [Mon, 26 Jul 2021 09:01:10 +0000 (11:01 +0200)]
Bug 28408: Add new column to the table settings config

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28408: Add 'Last updated' column to suggestions table
Nick Clemens [Fri, 28 May 2021 12:52:03 +0000 (12:52 +0000)]
Bug 28408: Add 'Last updated' column to suggestions table

We have specific meanings for the different dates in suggestions
Managed - means the status was changed or the suggestion edited, but doesn't change if item type updated
Modification - implies an edit of the subscript, not updated if status changed alone
Updated - this is the date field in the DB, which is actually a timestamp

The cronjob purge_suggestions.pl uses teh 'date' field

For a user, a suggestion can look old in the interface, but be considered recent by the script

To clear the confusion we should show the timestamp as well

To test:
1 - Add a suggestion
2 - In the DB, pretend you set it in the past:
    UPDATE suggestions SET manageddate='2021-01-01', suggesteddate='2021-01-01', date='2021-01-01 12:12:12';
3 - Click 'Go' In Organize by: Status
4 - Note the suggestion looks old now
5 - Check the box, and click 'Update item types with:' -> Submit
6 - Prganize by status again
7 - No change?
8 - Check the DB:
    SELECT date FROM suggestions;
9 - The field is updated
10 - Apply patch
11 - Organize by status again
12 - See the 'Last updated' ate set to today

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28336: Add missing input for item_action
Nick Clemens [Wed, 12 May 2021 17:00:57 +0000 (17:00 +0000)]
Bug 28336: Add missing input for item_action

To test:
1 - Stage a marc file of authorities
2 - Manage the staged file
3 - Attempt to change the matching rule
4 - 500 Error, in intranet-error.log:
[Wed May 12 16:53:03.046652 2021] [cgi:error] [pid 52072] [client 172.19.0.1:50580] AH01215: C4::ImportBatch::SetImportBatchItemAction(): DBI Exception: DBD::mysql::st execute failed: Column 'item_action' cannot be null [for Statement "UPDATE import_batches SET item_action = ? WHERE import_batch_id = ?" with ParamValues: 0=undef, 1="1"] at /kohadevbox/koha/tools/manage-marc-import.pl line 160: /kohadevbox/koha/tools/manage-marc-import.pl, referer: http://localhost:8081/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=1
5 - Apply patch
6 - Reload page and change matching rule
7 - Success!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27885: (follow-up) Use biblionumbers instead of biblionumber in form action for...
Nick Clemens [Wed, 26 May 2021 12:17:41 +0000 (12:17 +0000)]
Bug 27885: (follow-up) Use biblionumbers instead of biblionumber in form action for club search

This simply matches the code on the patrons search tab

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27885: Populate biblionumbers parameter using biblionumbers array
Nick Clemens [Fri, 5 Mar 2021 17:32:28 +0000 (17:32 +0000)]
Bug 27885: Populate biblionumbers parameter using biblionumbers array

Currently we send $biblionumbers as the parameter, but this is just apassthrough form when a list of biblios is selected for placing a hold

If passed a single biblionumber we push it into @biblionumbers and use that for building the biblio loop

This patch uses @biblionumbers to avoid sending a blank variable in the URL

To test:
1 - On the staff client click 'place hold' for an individual record
2 - Use the form to find a patron
3 - Note the url is:
    http://localhost:8081/cgi-bin/koha/reserve/request.pl?biblionumbers=
4 - Apply patch
5 - Repeat
6 - The url is now like:
    http://localhost:8081/cgi-bin/koha/reserve/request.pl?biblionumbers=248
    (but with whatever biblionumber you chose)
7 - Perform a search and select multiple biblios and confirm you can place holds as before

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
JD Amended patch: Add missing space

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28622: (bug 15758 follow-up) Remove incorrect branch selection in adv search
Jonathan Druart [Wed, 23 Jun 2021 14:19:15 +0000 (16:19 +0200)]
Bug 28622: (bug 15758 follow-up) Remove incorrect branch selection in adv search

From
  commit df97814f3034a3d5015546c4eca21f08ae951e37
  Bug 15758: Koha::Libraries - Remove GetBranches

+    selected_branchcode => ( C4::Context->IsSuperLibrarian ? C4::Context->userenv : '' ),

And

-        [% PROCESS options_for_libraries libraries => Branches.all() %]
+        [%# FIXME Should not we filter the libraries displayed? %]
+        [% PROCESS options_for_libraries libraries => Branches.all( selected => selected_branchcode, unfiltered => 1 ) %]

The change in the pl is wrong as it should pass C4::Context->userenv->{branch},
but prior to this commit it seems that we didn't select the logged in
library anyway.

Looks like we should remove this code but preserve the current behavior and select "All libraries".

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 22801: (follow-up) Use date-of-publication directly
Nick Clemens [Thu, 17 Jun 2021 12:36:01 +0000 (12:36 +0000)]
Bug 22801: (follow-up) Use date-of-publication directly

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 22801: Advance search yr must use date-of-publication and not copydate
Fridolin Somers [Fri, 22 Jan 2021 08:39:33 +0000 (09:39 +0100)]
Bug 22801: Advance search yr must use date-of-publication and not copydate

In advanced search with Elasticsearch the limit on years range is actually using copydate :

Koha/SearchEngine/Elasticsearch/QueryBuilder.pm in _fix_limit_special_cases() :
        if ( $l =~ /^yr,st-numeric,ge=/ ) {
            my ( $start, $end ) =
              ( $l =~ /^yr,st-numeric,ge=(.*) and yr,st-numeric,le=(.*)$/ );
            next unless defined($start) && defined($end);
            push @new_lim, "copydate:[$start TO $end]";
        }

With Zebra it uses date-of-publication and also in Koha/SearchEngine/Elasticsearch/QueryBuilder.pm :

our %index_field_convert = (
(...)
    'yr' => 'date-of-publication',

This patch uses %index_field_convert to perform 'yr' limit.

Test plan:
1) Apply patch
2) Use Elasticsearch searchengine
3) Go to advanced search with 'More options'
4) Perform a search with a year limit (value or range)
5) Check results are correct

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28747: Clarify working on RestrictionBlockRenewal
Andrew Fuerste-Henry [Fri, 23 Jul 2021 11:57:36 +0000 (11:57 +0000)]
Bug 28747: Clarify working on RestrictionBlockRenewal

To test, apply patch, restart services and reload page, confirm that now the syspref says "from the staff interface."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28679: Unable to click "Log in to your account" when GoogleOpenIDConnect is enabled
Owen Leonard [Mon, 12 Jul 2021 13:29:27 +0000 (13:29 +0000)]
Bug 28679: Unable to click "Log in to your account" when GoogleOpenIDConnect is enabled

This patch corrects the login link in the OPAC when GoogleOpenIDConnect
is enabled. It removes modal-related markup which was causing the link
to fail.

To test, apply the patch and enable the GoogleOpenIDConnect system
preference.

- In the OPAC, click the "Log in to your account" link in the header.
  You should be redirected to a Google authentication form.
- Disable the GoogleOpenIDConnect preference. The login link in the OPAC
  should trigger a modal login form.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28631: Holds History title link returns "not found" error
Owen Leonard [Wed, 30 Jun 2021 15:42:50 +0000 (15:42 +0000)]
Bug 28631: Holds History title link returns "not found" error

This patch corrects a broken path in the OPAC holds history page.

This patch also corrects the breadcrumb markup which didn't conform to
the new Bootstrap 4 pattern.

To test, apply the patch and log into the OPAC as a patron who has past
or current holds.

- View the "your holds history" page.
- Click a title link in the table of holds. It should take you to the
  correct bibliographic detail page.
- Check the breadcrumbs of the page. They should look consistent with
  breadcrumb navigation on other pages in the OPAC.

Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28745: (bug 28158 follow-up) Restore the items table once the job is done
Jonathan Druart [Fri, 23 Jul 2021 09:46:33 +0000 (11:46 +0200)]
Bug 28745: (bug 28158 follow-up) Restore the items table once the job is done

Caused by bug 28158, the batch item modifications tool does not longer
display the table with the items that have been modified on the result screen.

There is no more fork and so no more completedJobID var.
We must process the items THEN build the items' info.

Test plan:
Use the batch item modification tools to modify some items.
Confirm that with this patch the table with the modified items is
displayed on the last screen.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoUpdate release notes for 21.05.02 release v21.05.02
Kyle M Hall [Mon, 26 Jul 2021 13:41:10 +0000 (09:41 -0400)]
Update release notes for 21.05.02 release

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoIncrement version for 21.05.02 release
Kyle M Hall [Mon, 26 Jul 2021 13:17:58 +0000 (09:17 -0400)]
Increment version for 21.05.02 release

2 years agoFix translations for Koha 21.05.02
Kyle M Hall [Mon, 26 Jul 2021 13:14:50 +0000 (09:14 -0400)]
Fix translations for Koha 21.05.02

2 years agoTranslation updates for Koha 21.05.02
Koha translators [Mon, 26 Jul 2021 11:46:50 +0000 (08:46 -0300)]
Translation updates for Koha 21.05.02

2 years agoBug 28660: (bug 21325 follow-up) Fix auto self check
Jonathan Druart [Tue, 6 Jul 2021 12:48:51 +0000 (14:48 +0200)]
Bug 28660: (bug 21325 follow-up) Fix auto self check

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Works as expected.
The need for an additional check of pref WebBasedSelfCheck is
merely theoretical.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28483: Remove warnings from Search.t
Tomas Cohen Arazi [Tue, 22 Jun 2021 19:41:55 +0000 (16:41 -0300)]
Bug 28483: Remove warnings from Search.t

There are too many warnings about uninitialized variables in Search.pm.
This patch deals with that, the same way it is dealt accross the file:
by setting an empty string when things are not defined.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Search.t
=> FAIL: Wow, too many warnings. Some related to this bug, some not.
2. Apply this patch
3. Repeat 1
=> SUCCESS: No more warnings!
4. 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: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28483: Fix t/Search/buildQuery.t
Jonathan Druart [Tue, 13 Jul 2021 07:46:59 +0000 (09:46 +0200)]
Bug 28483: Fix t/Search/buildQuery.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28384: Add 'no_items' option to TransformMarcToKoha
Nick Clemens [Wed, 19 May 2021 10:19:33 +0000 (10:19 +0000)]
Bug 28384: Add 'no_items' option to TransformMarcToKoha

This patch adds a new option 'no_items' and uses it in the C4::Search::searchResults
routine. We don't use the item info fetched here, so skipping those lines saves us time.

Additionally, I fix an incorrect FIXME comment, and pass the ISBN returned by the routine above
into GetNormalizedISBN to save another lookup

TO test:
1 - Enable AmazonCoverImages system preference
2 - Search staff client with a term that returns books with covers
3 - Apply patch
4 - prove -v t/db_dependent/Biblio/TransformMarcToKoha.t
5 - Confirm searching works
6 - Confirm Amazon images display (normalized_isbn is used for these)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Amended, replacing a tab character.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27908: Add support for circulation status 1 ( other ) for damaged items
Kyle M Hall [Wed, 10 Mar 2021 15:45:18 +0000 (10:45 -0500)]
Bug 27908: Add support for circulation status 1 ( other ) for damaged items

Some libraries would like to transmit if an item is damaged via the
circulation status field. There is no specific code for a damaged item,
so we should use value 1 (other) along with an AF screen message to
describe the reason for the the circulation status of 1.

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

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27908: Add unit test
Kyle M Hall [Wed, 10 Mar 2021 15:45:15 +0000 (10:45 -0500)]
Bug 27908: Add unit test

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27907: Add support for circulation status 2 ( on order )
Kyle M Hall [Wed, 10 Mar 2021 15:33:28 +0000 (10:33 -0500)]
Bug 27907: Add support for circulation status 2 ( on order )

In Koha, we represent on order items by giving those items a notforloan
value less then zero. We can use this to implement circ status 02 ( on
order ) in for SIP.

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27907: Add unit test
Kyle M Hall [Wed, 10 Mar 2021 15:33:23 +0000 (10:33 -0500)]
Bug 27907: Add unit test

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27906: Add support for circulation status 9 ( waiting to be re-shelved )
Kyle M Hall [Wed, 10 Mar 2021 15:24:16 +0000 (10:24 -0500)]
Bug 27906: Add support for circulation status 9 ( waiting to be re-shelved )

In Koha, we can support circ status 09 in SIP by checking if the item's
location is "CART".

Test Plan:
1) prove t/db_dependent/SIP/Transaction.t

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27906: Add unit test
Kyle M Hall [Wed, 10 Mar 2021 15:22:54 +0000 (10:22 -0500)]
Bug 27906: Add unit test

Signed-off-by: Christopher Kellermeyer - Altadena Library District <ckellermeyer@altadenalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26760: Escape URI parameters in redirect URI to paycollect.pl
Julian Maurice [Wed, 12 May 2021 08:24:30 +0000 (10:24 +0200)]
Bug 26760: Escape URI parameters in redirect URI to paycollect.pl

Also remove useless '%.2f' formatting of amount and amountoutstanding

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26760: Redirect to paycollect.pl when clicking on "Save and pay"
Julian Maurice [Wed, 21 Oct 2020 10:58:29 +0000 (12:58 +0200)]
Bug 26760: Redirect to paycollect.pl when clicking on "Save and pay"

Bug 14898 added the "Save and pay" button that redirects to "Make a
payment" tab after creating a manual invoice
This requires the user to click on another "Pay" button before being
taken to the real payment form.
By redirecting directly to paycollect.pl, this useless step will no
longer be needed.

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28644: Fix calling borrowernumber on undefined value
Marcel de Rooy [Thu, 1 Jul 2021 14:13:05 +0000 (14:13 +0000)]
Bug 28644: Fix calling borrowernumber on undefined value

If the hold is not found (e.g. already cancelled), we should
return earlier without crashing:
    Can't call method "borrowernumber" on an undefined value at /usr/share/koha/C4/Reserves.pm line 521
    (Note: line number from 19.11)

Test plan:
Run t/db_dependent/Reserves.t
Add a hold, go to user menu with holds in OPAC.
At the same time, cancel this hold from staff.
Now click the Cancel in OPAC.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28561: Remove DBIC warning in opac-shelves
Jonathan Druart [Fri, 18 Jun 2021 10:36:00 +0000 (12:36 +0200)]
Bug 28561: Remove DBIC warning in opac-shelves

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28561: Fix noisy warning about $direction too
Marcel de Rooy [Mon, 14 Jun 2021 12:51:13 +0000 (12:51 +0000)]
Bug 28561: Fix noisy warning about $direction too

Use of uninitialized value $direction in string ne at /usr/share/koha/opac/opac-shelves.pl line 265.

Bonus:
Use of uninitialized value $sortfield in string eq at /usr/share/koha/opac/opac-shelves.pl line 264.

Test plan:
While testing patch 1, check the logs for these warnings with and
without this patch.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28399: Remove txn error from batchRebuildItemsTables.pl
Jonathan Druart [Thu, 24 Jun 2021 13:11:18 +0000 (15:11 +0200)]
Bug 28399: Remove txn error from batchRebuildItemsTables.pl

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28597: Fetch the logged in branchcode for OpacSuggestioninstructions
Nick Clemens [Fri, 18 Jun 2021 13:09:29 +0000 (13:09 +0000)]
Bug 28597: Fetch the logged in branchcode for OpacSuggestioninstructions

To test:
 1 - Set two news items with location 'OpacSuggestioninstructions'
 2 - One should be for all libraries
 3 - One should be for a specific library
 4 - Sign in to opac with user from the specific library
 5 - Add a suggestion
 6 - The instructions only show the all libraries item
 7 - Apply patch
 8 - Reload
 9 - All libraries and specific library items are shown
10 - Allow anonymous suggestions:  AnonSuggestions - Allow
11 - Sign out of opac
12 - Add a suggestion
13 - Only all librares news is visible

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28455: Update wording on TrackLastPatronActivity
Andrew Fuerste-Henry [Thu, 3 Jun 2021 21:11:56 +0000 (21:11 +0000)]
Bug 28455: Update wording on TrackLastPatronActivity

This patch updates the wording on TrackLackPatronActivity to maintain the corrections from bug 28467 and also reflect the change made in this bug. It should now read: The first time each day that a patron either logs into the OPAC, connects to Koha via SIP, or checks an item out, borrowers.lastseen will update with the current date and time.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28455: lastseen should be updated at checkout if TrackLastPatronActivity is enabled
Nick Clemens [Tue, 25 May 2021 18:20:25 +0000 (18:20 +0000)]
Bug 28455: lastseen should be updated at checkout if TrackLastPatronActivity is enabled

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28611: Fix width to 50% for additem form elements
Jonathan Druart [Tue, 22 Jun 2021 09:46:55 +0000 (11:46 +0200)]
Bug 28611: Fix width to 50% for additem form elements

This patch suggests to set the width of select and input to 50%

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28299: Make buildKohaItemsNamespace accept Koha::Items
Tomas Cohen Arazi [Mon, 10 May 2021 08:01:02 +0000 (10:01 +0200)]
Bug 28299: Make buildKohaItemsNamespace accept Koha::Items

This patch makes buildKohaItemsNamespace (and its only caller,
XSLTParse4Display) accept a an optional Koha::Items resultset.

This way we don't need to calculate (from the DB) the list of hidden
itemnumbers, but solve it in one query.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28299: Take OpacHiddenItems into account on opac-shelves
Jonathan Druart [Fri, 7 May 2021 09:16:17 +0000 (11:16 +0200)]
Bug 28299: Take OpacHiddenItems into account on opac-shelves

hidden_items was not passed to XSLTParse4Display

2 things:
* Should we hide the biblio record if OpacHiddenItemsHidesRecord is set?
* allow_onshelf_holds is not working like in other scripts, what's the
expected behaviour? If hidden should we completely ignore the item?

Test plan:
1. Without the patch
2. fill OpacHiddenItems with «damaged: [1]»
3. find a record with several item
4. mark one of them as damaged
5. OPAC: go to the record, you shouldn't see the damaged item
6. add the record to a list
7. see the list
8. in Availability you see the damaged item mentioned, this is the issue
9. apply the patches and restart the services
10. the list should not mention the damaged item :D

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28299: Unit tests for buildKohaItemsNamespace
Tomas Cohen Arazi [Mon, 10 May 2021 14:17:57 +0000 (11:17 -0300)]
Bug 28299: Unit tests for buildKohaItemsNamespace

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28462: Remove line breaks in TT tags
Jonathan Druart [Wed, 23 Jun 2021 07:50:55 +0000 (09:50 +0200)]
Bug 28462: Remove line breaks in TT tags

Same as previous patch for other files.
Looks like the problem exists only with IF.

== test plan ==
1. See the problematic strings in a given language
     git grep "\bIF\b" misc/translator/po | grep -v '#' | grep '\bzh-Hant-TW'
2. update the language
   misc/translator/translate update zh-Hant-TW
3. Recheck the problematic strings, they aren't here anymore
4. Check the diff: git diff
   and search the if's with «/-.* IF » to see how the deleted strings
   look like and that it makes sense.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28462: Remove TT tag on several lines - opac-advsearch.tt
Jonathan Druart [Wed, 26 May 2021 14:24:32 +0000 (16:24 +0200)]
Bug 28462: Remove TT tag on several lines - opac-advsearch.tt

It fixes the translation in case the operators have been translated

Test plan:
1. misc/translator/translate update pt-BR
2. In pt-BR-opac-bootstrap.po , find OpacAdvSearchMoreOptions
3. sabotage the translation part, like replacing IF with something else
4. misc/translator/translate install pt-BR
5. enable and use pt-BR and hit opac-advsearch.pl
6. Notice the error
   Template process failed: file error - parse error - /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/pt-BR/modules/opac-advsearch.tt line 409: unexpected token (e)                                                    [% IF (OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size> 0 e extended_options) ou (OpacAdvSearchOptions and OpacAdvSearchOptions.size> 0 e n expandido_options) %] at /kohadevbox/koha/C4/Templates.pm
7. Apply the patch and redo update and install of the language
8. Note that it's now working

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28524: Escape 'rank' in cat_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 12:51:08 +0000 (14:51 +0200)]
Bug 28524: Escape 'rank' in cat_issues_top.pl

It's a MySQL 8 keyword

Test plan:
Turn off strict_sql_modes (there are other problems in this script)
Hit Home Reports > Most-circulated items
Submit the form

Without this patch you got:
  You have an error in your SQL syntax; check the manual that
  corresponds to your MySQL server version for the right syntax to use
  near 'RANK, biblio.biblionumber AS ID, itemcallnumber as CALLNUM,
  ccode as CCODE, loca' at line 1

With this patch applied you see the report result view

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28523: Escape 'rank' in bor_issues_top.pl
Jonathan Druart [Wed, 16 Jun 2021 12:54:47 +0000 (14:54 +0200)]
Bug 28523: Escape 'rank' in bor_issues_top.pl

It's a MySQL 8 keyword

Test plan:
Turn off strict_sql_modes (there are other problems in this script)
Hit Home Reports > Patrons with the most checkouts
Submit the form

Without this patch you got:
    You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to
    use near 'RANK, borrowers.borrowernumber AS ID FROM `old_issues`

With this patch applied you see the report result view

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28571: Remove C4::Auth::_session_log
Jonathan Druart [Wed, 16 Jun 2021 13:28:01 +0000 (15:28 +0200)]
Bug 28571: Remove C4::Auth::_session_log

It's not used and must be removed

Test plan:
  % git grep _session_log
must not return any result.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28601: Fix 'Home' breadcrumd on circulation-home.pl
Nick Clemens [Fri, 18 Jun 2021 15:45:42 +0000 (15:45 +0000)]
Bug 28601: Fix 'Home' breadcrumd on circulation-home.pl

To test:
1 - Got to 'Circulation'
2 - Click 'Home' in breadcrumbs
3 - You are still in circulation home
4 - Apply patch
5 - reload page
6 - Click 'Home'
7 - Success!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28604: Prevent double encoding of MARC::Record::MiJ->to_mij output
Tomas Cohen Arazi [Fri, 18 Jun 2021 21:32:37 +0000 (18:32 -0300)]
Bug 28604: Prevent double encoding of MARC::Record::MiJ->to_mij output

This patch fixes a double-encoding issue with MiJ output.

Mojolicious' *text* renderer encodes the passed information according to
the request context. [1]

MARC::Record::MiJ->to_mij, conveniently encodes the string before
output [2].

This causes double encoding.

So the solution to this situation, is to use the *data* renderer, which
doesn't perform any encoding [3].

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests contain diacritics and fail!
3. Have a record with diacritics
4. Try the API routes for fetching a biblio:
   $ curl --location --request GET 'http://localhost:8080/api/v1/public/biblios/144' \
          --header 'Accept: application/marc-in-json'
   (replace the record id with the one you've chosen)
=> FAIL: Boo, double encoding
5. Bonus point: you can try it on the non-public route, but you need
   more configuration boilerplate (basic auth, permissions). If you look
   at the fix, you will understand the tests cover it and no need to
   complicate yourself.
6. Apply this patch
7. Repeat 2
=> SUCCESS: Tests pass!
8. Repeat 4 (and maybe 5)
=> SUCCESS: No double encoding! Yay!
9. Sign off :-D

[1] https://metacpan.org/release/MRAMBERG/Convos-0.5/view/local/lib/perl5/Mojolicious/Guides/Rendering.pod#Rendering-text
[2] https://metacpan.org/dist/MARC-File-MiJ/source/lib/MARC/Record/MiJ.pm#L111
[3] https://metacpan.org/release/MRAMBERG/Convos-0.5/view/local/lib/perl5/Mojolicious/Guides/Rendering.pod#Rendering-data

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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28604: Regression tests
Tomas Cohen Arazi [Fri, 18 Jun 2021 21:30:56 +0000 (18:30 -0300)]
Bug 28604: Regression tests

This patch introduces regression tests for the encoding issue with MiJ
output.

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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28480: (QA follow-up) Add unit test
Nick Clemens [Fri, 11 Jun 2021 18:02:11 +0000 (18:02 +0000)]
Bug 28480: (QA follow-up) Add unit test

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28480: Add q parameters for GET /patrons
Tomas Cohen Arazi [Fri, 28 May 2021 11:34:29 +0000 (08:34 -0300)]
Bug 28480: Add q parameters for GET /patrons

This patch adds the q query parameters to the route.

To test:
1. Try the route with the following query parameter:
   q={"patron_id":2}
   i.e. GET /api/v1/patrons?q={"patron_id":2}
=> FAIL: You get a bad request respose
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: You get the patron
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28581: (QA follow-up) Fix method on unblessed reference
Marcel de Rooy [Mon, 21 Jun 2021 08:47:59 +0000 (08:47 +0000)]
Bug 28581: (QA follow-up) Fix method on unblessed reference

Speaks for itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28581: Enhance POD for EnqueueLetter
Martin Renvoize [Thu, 17 Jun 2021 13:47:07 +0000 (14:47 +0100)]
Bug 28581: Enhance POD for EnqueueLetter

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28581: Use 'from_email_address' where appropriate
Martin Renvoize [Thu, 17 Jun 2021 13:30:59 +0000 (14:30 +0100)]
Bug 28581: Use 'from_email_address' where appropriate

This patch replaces a few more trivial cases where we were using
library->branchemail with a fallback to KohaAdminEmail to just use the
new library->from_email_address method directly instead.

There were also a couple of cases where we were passing borrowernumber
and the patrons library from address too.. this is unneccesary as the
code in _send_email_massage will already default to patron library from
address if we do not pass an override.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Added a semicolon.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28581: (QA follow-up) Prevent code failure
Martin Renvoize [Thu, 17 Jun 2021 13:12:23 +0000 (14:12 +0100)]
Bug 28581: (QA follow-up) Prevent code failure

This patch prevents a fatal error when both $params->{from} and
$params->{borrowernumber} are undefined. We fallback to
KohaAdminEmailAddress before finally falling through to setting a
failure status for the message if that last fallback is not found.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28581: Use from_email_address in the codebase
Marcel de Rooy [Thu, 17 Jun 2021 09:59:18 +0000 (09:59 +0000)]
Bug 28581: Use from_email_address in the codebase

Adding only a few (trivial) cases now. Changes in C4::Letters
are not trivial after all..
We now add the KohaAdminEmail fallback implicitly when the from
address was still empty. The extra check makes us not rely on
a do or die action in Email::Stuffer.

Test plan:
Run password recovery or membership expiry cron.
Check sender address.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>