koha.git
3 years agoBug 26633: Add API documentation
Kyle M Hall [Fri, 6 Nov 2020 18:15:14 +0000 (13:15 -0500)]
Bug 26633: Add API documentation

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: Remove jquery.checkboxes.min.js include
Jonathan Druart [Thu, 5 Nov 2020 09:41:32 +0000 (10:41 +0100)]
Bug 26633: Remove jquery.checkboxes.min.js include

No longer exists and not used in this template

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: POD for the exceptions file
Tomas Cohen Arazi [Tue, 3 Nov 2020 14:14:26 +0000 (11:14 -0300)]
Bug 26633: POD for the exceptions file

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: (QA follow-up) Tests on error condition
Tomas Cohen Arazi [Tue, 3 Nov 2020 14:06:58 +0000 (11:06 -0300)]
Bug 26633: (QA follow-up) Tests on error condition

This patch highlights a problem with the try/catch conditions in the
ad() controlled method. Tests are added, and the controller is fixed to
reflect the right behaviour.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/transfer_limits.t
=> SUCCESS: Tests pass! 409 is returned as appropriate!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: (QA follow-up) Action buttons should not remain grayed out if the same...
Kyle M Hall [Tue, 27 Oct 2020 18:01:47 +0000 (14:01 -0400)]
Bug 26633: (QA follow-up) Action buttons should not remain grayed out if the same action is used multiple times in a row

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: (QA follow-up) Change label to "collection" as we display the description
Katrin Fischer [Fri, 23 Oct 2020 00:51:34 +0000 (00:51 +0000)]
Bug 26633: (QA follow-up) Change label to "collection" as we display the description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: Fix indirect object notation
Katrin Fischer [Sun, 25 Oct 2020 00:54:54 +0000 (02:54 +0200)]
Bug 26633: Fix indirect object notation

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: Add advanced editor for transfer limits
Kyle M Hall [Thu, 8 Oct 2020 15:15:44 +0000 (11:15 -0400)]
Bug 26633: Add advanced editor for transfer limits

The current transfer limits editor works great for Koha instances with
small numbers of branches. However, for consortiums with dozens or even
hundreds of libraries, the editor does not work well or effectively.

We should provide an "advanced" editor displays all to/from library
combinations in a grid and allows them to be edited in a manner somewhat
similar to the transport cost matrix editor.

Test Plan:
1) Apply this patch
2) Browse to the transfer limits editor
3) Click the new "Switch to advanced editor" link
4) Select a collection code/item type to edit limits for
5) Test the "Check all" function
6) Test the "Uncheck all" function
7) Test the "Check" column function
8) Test the "Uncheck" column function
9) Test the "Check" row function
10) Test the "Uncheck" row function
11) Test individual checkboxes/table cells

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26633: Add REST API for managing transfer limits
Kyle M Hall [Thu, 8 Oct 2020 15:14:26 +0000 (11:14 -0400)]
Bug 26633: Add REST API for managing transfer limits

Test Plan:
1) prove t/db_dependent/api/v1/transfer_limits.t

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 26633: Convert transfer_limit.json to YAML

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27716: Update permissions for patroncards creator
Martin Renvoize [Fri, 19 Feb 2021 10:12:32 +0000 (10:12 +0000)]
Bug 27716: Update permissions for patroncards creator

The various subpages of the label creator tool we're under the
'catalogue' permission. There is however a 'label_creator' subpermission
of tools which is more appropriate.

Test plan
1/ Setup a user with just the 'catelogue' permission (to enable logging
into the staff interface)
2/ With the patch applied you should not be able to access the following
pages (either via navigation in the UI or by typing them into the
browser address bar directly)
  - /patroncards/add_user_search.pl
  - /patroncards/edit-batch.pl
  - /patroncards/edit-layout.pl
  - /patroncards/edit-profile.pl
  - /patroncards/edit-template.pl
  - /patroncards/home.pl
  - /patroncards/image-manage.pl
  - /patroncards/manage.pl
  - /patroncards/print.pl
3/ Signoff

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>
3 years agoBug 27939: Compiled CSS
Jonathan Druart [Tue, 16 Mar 2021 15:05:17 +0000 (16:05 +0100)]
Bug 27939: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27939: Update yarn.lock file
Jonathan Druart [Fri, 12 Mar 2021 08:30:02 +0000 (09:30 +0100)]
Bug 27939: Update yarn.lock file

There is a minor security vulnerability, it is good to fix it even if there is no impact on security: yarn is only used for dev purpose.

The the logs of https://wiki.koha-community.org/wiki/Development_IRC_meeting_24_February_2021

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
https://bugs.koha-community.org/show_bug.cgi?id=27938

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27860: Fix password recovery
Jonathan Druart [Fri, 5 Mar 2021 09:14:08 +0000 (10:14 +0100)]
Bug 27860: Fix password recovery

Same as the previous patch but for the password recovery feature.

Test plan:
1. Do not apply the patches
2. Set KohaAdminEmailAddress to an invalid email (root@localhost for
instance)
3. Use the password recovery feature
5. Boom (that must be fixed on a separate bug report)
6. Set KohaAdminEmailAddress to a valid email (root@example.org)
7. Use again the password recovery for a different user
8. Still Boom! (because it's processing the first invalid email)
9. Apply the patches, restart_all
10. Try again the password recovery
=> The email is sent!
Notice the change in DB, the first email is still there with status
"pending" and second email is sent!

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>
3 years agoBug 27860: Fix self-registration if messages with incorrect email are inqueued
Jonathan Druart [Fri, 5 Mar 2021 09:04:14 +0000 (10:04 +0100)]
Bug 27860: Fix self-registration if messages with incorrect email are inqueued

If the pref KohaAdminEmailAddress was not set correctly (invalid email)
and has been used to generate message, the message_queue table can contain
some messages that are not sent (pending) and will be processed each
time a new self-reg is done.
The PatronSelfRegistrationVerifyByEmail feature must send only the
notice we just generated, not the whole pending queue.

Test plan:
1. Do not apply the patches
2. Set KohaAdminEmailAddress to an invalid email (root@localhost for
instance)
3. Turn on PatronSelfRegistrationVerifyByEmail
4. Self-reg a patron
5. Boom (that must be fixed on a separate bug report)
6. Set KohaAdminEmailAddress to a valid email (root@example.org)
7. Self-reg a patron
8. Still Boom! (because it's processing the first invalid email)
9. Apply the patches, restart_all
10. Self-reg a patron
=> The email is sent!
Notice the change in DB, the first email is still there with status
"pending" and second email is sent!

QA: at step 10. TODO first email must be 'failed' (highlight in tests)
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>
3 years agoBug 27860: Add message_id param to SendQueuedMessages
Jonathan Druart [Fri, 5 Mar 2021 09:01:30 +0000 (10:01 +0100)]
Bug 27860: Add message_id param to SendQueuedMessages

We could use C4::Letter::GetMessage, but the query in
_get_unsent_messages join on borrowers and return the branchcode.
To prevent any regressions it's preferable to not modify
SendQueuedMessages.

Ideally we obviously need a Koha methods to have better and clean code..

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>
3 years agoBug 27597: Remove leading colon in ES query
Jonathan Druart [Wed, 3 Feb 2021 09:33:35 +0000 (10:33 +0100)]
Bug 27597: Remove leading colon in ES query

If we are searching on kw there is a leading colon at the beginning of
the generated query:
  kw:foo becomes :foo

Note that it only happens when there is no other terms before.

Test plan:
0. Don't apply the patch
1. Search for kw:foo
2. Notice the error
  Error: Unable to perform your search. Please try again.
and the logs say
  Failed to parse query [(:foo*)]
3. Apply the patch
4. Repeat the search and notice that you know get:
   "12 result(s) found for 'kw:foo'."

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27737: (follow-up) Minimal CSS changes to avoid regressions
Phil Ringnalda [Tue, 9 Mar 2021 03:33:06 +0000 (19:33 -0800)]
Bug 27737: (follow-up) Minimal CSS changes to avoid regressions

To keep the specificity of the rules we want to have apply to both the
biblio editor and also the authorities editor, we need to add the ID for
the authorities editor, rather than remove the ID for the biblio editor.

Also, the removal of the selectors for #authoritiestabs descendents was
regressing the display of authority record details, which is where that
plural authoritiestabs element lives.

Test plan:

1.  With neither patch from this bug applied, Cataloging - New record -
    Default framework.
2.  Shrink and widen your browser window, noticing how the input fields
    flex to remain the full width, keeping the controls to duplicate and
    delete a subfield out directly to the right of the input.
3.  Authorities - search for Perl (or any term that will match a record),
    click the linked authority term to open the Authority detail display
4.  Note how the field number, field description, and subfield descriptions
    are all different colors, and subfield codes are on the same line as
    the subfield contents.
5.  Apply both patches from this bug.
6.  Cataloging - New record - Default framework
7.  Verify that the input fields still behave the same as you widen and
    shrink your browser window
8.  Authorities - New authority - Chronological Term
9.  Verify that the input fields now behave like the ones in the biblio
    editor, shrinking and widening to fill the width of the page, keeping
    the controls to duplicate and delete subfields immediately to the
    right of the field
10. Authorities - search for Perl, click the linked authority term to open
    the Authority detail display
11. Verify that the tag number, field description and subfield descriptions
    are still properly colored and subfield codes are still on the same
    line as the subfield contents.

Signed-off-by: David Nind <david@davidnind.com>
Trivial fixup for a copy-paste failure, missed the y on
subfield_loop_mandator

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27737: Tag editor for authority lookup broken in authority editor
Owen Leonard [Tue, 2 Mar 2021 17:44:35 +0000 (17:44 +0000)]
Bug 27737: Tag editor for authority lookup broken in authority editor

This patch changes the markup structure for the authorities
editor so that it better matches that of the basic bibliographic
record editor. This allows the authority-linking JavaScript to
correctly target fields on both pages.

To test, apply the patch and go to Authorities in the staff client.

 - Create or edit an authority record.
 - Switch to tab 5 and if necessary click one of the tag names (e.g.
   "SEE ALSO FROM TRACING--PERSONAL NAME") to expand the subfields.
 - Click the "..." plugin link next to subfield a ("Personal name" in
   this example).
 - In the popup window, search for an authority record.
 - Click "Choose" next to one of the results.
 - The popup window should close and the authority editor should contain
   data from the record you chose, including a value in $9 and $a.
 - Test with various records to confirm that data in other fields is
   copied correctly, for instanct $d, dates associated with a name, $t
   title of a work.
 - Test other JavaScript-driven interactions in the editor:
   - Duplicate repeatable tag
   - Remove repeatable tag
   - Empty tag
   - Reorder sortable tags (e.g. multiple 500 tags)
   - Reorder sortable subfields
   - Duplicate repeatable subfield
   - Remove repeatable subfield
   - Empty repeatable subfield

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=22737

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>
3 years agoBug 27820: add all missing use in misc/cronjobs/plugins_nightly.pl
Fridolin Somers [Mon, 1 Mar 2021 10:40:56 +0000 (11:40 +0100)]
Bug 27820: add all missing use in misc/cronjobs/plugins_nightly.pl

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

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

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

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26273: (QA follow-up) Use escape_str/price for escaping
Martin Renvoize [Thu, 11 Mar 2021 13:55:00 +0000 (13:55 +0000)]
Bug 26273: (QA follow-up) Use escape_str/price for escaping

This patch uses the global escape_str/escape_price functions in the register
page.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26273: (follow-up) Add 'Cashier' to the cashups table
Martin Renvoize [Thu, 11 Feb 2021 10:19:57 +0000 (10:19 +0000)]
Bug 26273: (follow-up) Add 'Cashier' to the cashups table

This patch adds the 'Cashier' field as discussed on the bug report.

Test plan
1/ Apply patch and reload the register page to refresh the table
2/ Note that a 'Cashier' field now appears in the table
3/ Sorting and searching on 'Cashier' should work as expected
4/ Default sorting should remain as 'Date' order.
5/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 26273: (QA follow-up) Check for null firstname

This patch adds a test for firstname being defined before constructing
fullname from it.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26273: (follow-up) Format dates and money correctly.
Martin Renvoize [Wed, 10 Feb 2021 17:31:56 +0000 (17:31 +0000)]
Bug 26273: (follow-up) Format dates and money correctly.

This patch adds the missing formatting for the Datetime and Amount
fields.

Test plan
1/ Apply patch and reload register page to re-display the cashups table
2/ Note that the 'Date' field now displays a nicely formatted date
without an offset.
3/ Note that the 'Amount' field now displays the number according to
your money formatting preferences (with 2 decimal places in most cases)
4/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26273: Add historic cashups table to register page
Martin Renvoize [Mon, 1 Feb 2021 14:50:02 +0000 (14:50 +0000)]
Bug 26273: Add historic cashups table to register page

This patch adds a historic cashups table to the bottom of the register
transaction details page.  It will only display if one or more cashups
have taken place and contains links to allow display of the summary
detail modal for each cashup.

Test plan
1/ Enable UseCashRegisters
2/ Undertake a few transactions and cashups
3/ View the 'Register details' page
4/ Note the appearance of a 'Cashup history' section at the bottom of
the page
5/ Note that 'Summary' button displays the relevant modal
6/ Signoff

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Daniel Jones <daniel.jones@cheshiresharedservices.gov.uk>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 26273: (QA follow-up) Remove unrequired table_controls div

Looks like a copy/paste issue.. I don't believe we need this div at all
for the table to function as expected and adding it just creates uneeded
whitespace.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 26273: (QA follow-up) Add horizontal rule to distinguish tables

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27930: Move _escape_* from acqui/parcel.tt to js/staff-global.js
Martin Renvoize [Thu, 11 Mar 2021 14:22:54 +0000 (14:22 +0000)]
Bug 27930: Move _escape_* from acqui/parcel.tt to js/staff-global.js

This patch moves the _escape_str and _escape_price functions into the
staff-global.js include

Test plan
1/ The acquisitions parcel page should look the same before and after
the patch.
2/ Signoff

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22569: (QA follow-up) Use itemtype description
Martin Renvoize [Fri, 5 Mar 2021 12:33:41 +0000 (12:33 +0000)]
Bug 22569: (QA follow-up) Use itemtype description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22569: (QA follow-up) Make 'reason' translatable
Martin Renvoize [Fri, 5 Mar 2021 12:29:42 +0000 (12:29 +0000)]
Bug 22569: (QA follow-up) Make 'reason' translatable

Add a transfer_reasons include file for easy translation of the transer
reason codes.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22569: Add Unit Tests
Martin Renvoize [Fri, 18 Dec 2020 16:37:49 +0000 (16:37 +0000)]
Bug 22569: Add Unit Tests

Test plan:
1/ Run the updated unit tests

Signed-off-by: Kathleen Milne <kathleen.milne@cne-siar.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22569: Add a 'Transfers to send' report
Martin Renvoize [Fri, 18 Dec 2020 16:37:44 +0000 (16:37 +0000)]
Bug 22569: Add a 'Transfers to send' report

This patch adds a 'Transfers to send' report to the circulation page
which displays items which have been triggered for transfer but not
marked as sent.

Test plan
1) Setup a rotation plan and add some items to it as per the
   manual
2) Run the stockrotation cronjob with the --execute flag
3) Check that the expected items appear in the new 'Transfers to send'
   page.
4) Confirm that items marked with 'StockRotationAdvance' provide the
   option to mark the item as 'In demand' (Which will cancel the
   transfer and mark the item as in demand such that it will wait at the
   current branch for an additional stage period before being
   automatically picke for transfer again)
5) Setup a rotating collection
6) Trigger a collection transfer for the above collection
7) Check that the expected items appear in the new 'Transfers to send'
   page'.

Signed-off-by: Kathleen Milne <kathleen.milne@cne-siar.gov.uk>
Bug 22569: (QA follow-up) Rename script to snake_case

As requested, we simply rename the script, and references to it, to use
snake_case to make it clearer.

Bug 22569: (QA follow-up) Rename branchesloop to libraries

Bug 22569: (QA follow-up) Fix indentation in template

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 8426: Diacritics not being mapped for searching
Kyle M Hall [Thu, 12 Jul 2012 11:07:07 +0000 (07:07 -0400)]
Bug 8426: Diacritics not being mapped for searching

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

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

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

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

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

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

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

- Update a translation:

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

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

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

- Install the updated translation:

  > perl translate install fr-FR

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27268: (QA follow-up) Add Koha::Biblios to basket scripts
Marcel de Rooy [Fri, 5 Mar 2021 07:57:42 +0000 (07:57 +0000)]
Bug 27268: (QA follow-up) Add Koha::Biblios to basket scripts

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27268: Move GetMarcNotes to Koha namespace
Aleisha Amohia [Fri, 18 Dec 2020 01:55:48 +0000 (14:55 +1300)]
Bug 27268: Move GetMarcNotes to Koha namespace

This patch moves C4::Biblio::GetMarcNotes to
Koha::Biblio->get_marc_notes. This is so get_marc_notes can be
used in templates and notices.

To test:
1. Find a record that has a note (3xx for UNIMARC, 5xx for MARC21).
Confirm the notes still show as normal under the Descriptions tab.
2. Add the record to the cart.
3. View your cart and click 'more details'. Confirm notes show as
normal.
4. Log in to the OPAC. Find the record and add it to the cart
5. View the cart and click 'more details'. Confirm notes show as
normal.
6. View the record detail page and confirm the notes show as normal
under the Title Notes tab.
7. Confirm tests pass:
- t/Biblio.t
- t/db_dependent/Koha/Biblio.t

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
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>
3 years agoBug 27405: (follow up) Updates to accommodate currency entry
David Nind [Sat, 20 Feb 2021 23:06:01 +0000 (23:06 +0000)]
Bug 27405: (follow up) Updates to accommodate currency entry

This patch makes two modifications to allow the entry of
currency strings (for example, 1.25) so that it is consistent with other
payment entry forms.

- Inputmode changed to "decimal"
- Regex pattern changed to "^\d+(\.\d{2})?$" as found in
  admin/debit_types.tt

Signed-off-by: David Nind <david@davidnind.com>
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>
3 years agoBug 27405: Update koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt for ACC2
Catherine Ma [Wed, 20 Jan 2021 00:56:59 +0000 (00:56 +0000)]
Bug 27405: Update koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt for ACC2

This replaces the number type input in
intranet-tmpl/prog/en/modules/pos/register.tt so that it is
consistent with ACC2 guidelines.

Test plan:
1. Enable the EnablePointOfSale (set to Enable) and UseCashRegisters
   (set to Use) system preferences.
2. Add a new cash register for a library (Home > Point of sale > Create
   a new cash register)
3. Add some sample items for sale (Home > Point of sale > Configure
   items for purchase)
4. Add some sales (Home > Point of sale > Add some items, enter a
   payment and sleect Confirm)
5. Issue a refund (Home > Point of sale > Register details > select
   Issue refund for an item)
6. Try to enter text, numbers with several decimal places, and , or
   multiple .
7. Apply the patch.
8. Repeat steps 4-6 - should continue to function as expected, with
   appropriate warning messages for invalid entries.
9. Search koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt for
   input type="number" - there should be no occurences.
10. Sign off!

Sponsored by Catalyst IT

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>
3 years agoBug 26199: Include LDR for match check/match point
David Cook [Thu, 17 Dec 2020 04:05:39 +0000 (04:05 +0000)]
Bug 26199: Include LDR for match check/match point

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

Test plan:
0. prove t/Matcher.t

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

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

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27545: Keep the location if passed
Jonathan Druart [Mon, 25 Jan 2021 14:15:00 +0000 (15:15 +0100)]
Bug 27545: Keep the location if passed

Change in behaviour here, but expect. We must keep the location value if
passed to store.
Same for the permanent_location

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27545: Use NewItemsDefaultLocation from places where an item is created
Jonathan Druart [Mon, 25 Jan 2021 13:04:31 +0000 (14:04 +0100)]
Bug 27545: Use NewItemsDefaultLocation from places where an item is created

The syspref NewItemsDefaultLocation is used to set a default value for item's location.

But it seems that there are some weirdness in the behaviour:
1. It's only used from additem. It seems that it should be used from acq and serial modules as well. And maybe for the items import too.
2. It set the location even if another one has been picked from the UI
=> We UI must preselect the syspref's value, but the controller must pick what has been selected on the UI

This patch is adding the default to the UI and extend the use of the
pref to other areas.

Test plan:
Set a value to NewItemsDefaultLocation
Catalogue a new item and confirm that the syspref's value is picked to
selected the default value on the add item form
Same behaviour should apply to the acquisition and serial modules
When importing items, the default location must be used if the imported
items did not have a location defined.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27652: DBRev 20.12.00.023
Jonathan Druart [Tue, 9 Mar 2021 16:18:19 +0000 (16:18 +0000)]
Bug 27652: DBRev 20.12.00.023

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27652: (follow-up) Correct typo in database update
Owen Leonard [Wed, 10 Feb 2021 18:58:57 +0000 (18:58 +0000)]
Bug 27652: (follow-up) Correct typo in database update

This patch adds a missing "SET" in the database update. Before:

   UPDATE systempreferences
   value=REPLACE(value, '|', ',')

Corrected:

   UPDATE systempreferences
   SET value=REPLACE(value, '|', ',')

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>
3 years agoBug 27652: Display patron's categories for sysprefs expecting them
Jonathan Druart [Tue, 9 Feb 2021 16:19:59 +0000 (17:19 +0100)]
Bug 27652: Display patron's categories for sysprefs expecting them

This patch adds a new type of system preference entry option: patron
category. A preference with this type will show either a <select> with
patron categories to choose from or a multiple-select menu for choosing
one or more.

This prevents possible errors from incorrect category codes being
entered manually.

To test, apply the patch and run the database update.

- Go to Administration -> System preferences.
- Test each of the updated preferences to confirm that the available
  options are correct and that your selections are correctly saved.

  - Single category selections, PatronSelfRegistrationDefaultCategory
    and GoogleOpenIDConnectDefaultCategory. With each of these you
    should see a dropdown where you can select of all the existing
    patron categories.

  - Multiple selections, OPACHoldsIfAvailableAtPickup and
    BatchCheckouts: These preferences should have an option for
    selecting one or more system preferences at once.

- Test the pages affected by the updated system preferences:

- With BatchCheckouts enabled, confirm that the batch checkout page is
  correctly limited by patron category.

- Set the OPACHoldsIfAvailableAtPickup preference to "Don't allow" and
  select at least one patron category in the
  OPACHoldsIfAvailableAtPickupExceptions preference.
- Log in to the OPAC as a patron whose category was not selected in
  the OPACHoldsIfAvailableAtPickupExceptions preference.
- Try to place a hold on an item which is available at a library.
- When confirming the hold, the libraries where the item is available
  should be disabled in the "Pick up location" dropdown.
- Repeat the process as a patron whose category was selected in
  OPACHoldsIfAvailableAtPickupExceptions. There should be no disabled
  pickup locations.

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>
3 years agoBug 27766: Hide expired news items by default
Owen Leonard [Tue, 23 Feb 2021 17:25:47 +0000 (17:25 +0000)]
Bug 27766: Hide expired news items by default

This patch modifies the news page in the staff interface so that expired
news items are hidden by default. A checkbox in the sidebar can be
checked to show the hidden rows.

To test you should have multiple news items, some expired and some
unexpired.

 - Apply the patch and go to Tools -> News
 - The table of news items as it initially appears should not include
   any expired news items.
 - In the sidebar, check the "Show expired" checkbox.
 - The expired news items should now appear.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27751: Phase out jquery.cookie.js: Batch item modifications
Owen Leonard [Mon, 22 Feb 2021 16:49:12 +0000 (16:49 +0000)]
Bug 27751: Phase out jquery.cookie.js: Batch item modifications

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

- Submit a batch of barcodes for modification.
- Uncheck some checkboxes to hide columns in the table showing your
  submitted items.
- Return to the batch item modification page and submit your batch
  again.
- The columns you selected should still be hidden.
- Submit a batch of items for deletion.
- The same columns should be hidden here too.
- Also test that the "Show all columns" and "Hide all columns" buttons
  work and that the changes persist across batches.

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>
3 years agoBug 27699: Add register information to responsive staff interface header menu
Owen Leonard [Fri, 12 Feb 2021 19:34:05 +0000 (19:34 +0000)]
Bug 27699: Add register information to responsive staff interface header menu

This patch adds register information to the version of the header menu
shown when the browser width is narrower.

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

- If necessary, create at least one cash register for your library under
  Administration -> Cash registers.
- From any page in the staff interface you should see a menu in the
  header showing your username and logged-in branch.
- Expand the menu and choose "Set library, desk and register."
- Select a cash register and save.
- The cash register information should now appear in the header menu.
- Narrow the width of the browser until the menu collapses and shows
  only a user icon.
- When you expand this version of the menu you should see the
  currently-suggested register.

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>
3 years agoBug 27682: (follow-up) Make sure table is drawn with correct width
Owen Leonard [Thu, 4 Mar 2021 18:39:15 +0000 (18:39 +0000)]
Bug 27682: (follow-up) Make sure table is drawn with correct width

The DataTables plugin calculates the width of the fixed header based on
the initial width of the corresponding table. Since these tables are
inside jQueryUI tabs, the width changes when the tabs are initialized
and jQueryUI adds its classes to the table's container.

This patch "manually" adds the relevant classes to the markup so that
the table's container is drawn with the right padding from the start.

Also fixed: Don't try to destroy "oldTableId" if the tableInit function
didn't pass an oldtabid.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27682: Add a floating table header for Search engine configuration
Owen Leonard [Fri, 12 Feb 2021 12:57:56 +0000 (12:57 +0000)]
Bug 27682: Add a floating table header for Search engine configuration

This patch adds DataTables options to the tables on the search engine
configuration pages. The table on the "Search fields" tab will be
sortable, all tables will be searchable, and all tables will have
floating headers.

To test you should have the SearchEngine preference set to
"Elasticsearch."

- Apply the patch and go to Administration -> Search engine
  configuration (Elasticsearch)
- Test the tables under each tab, "Search fields," "Bibliographic
  records," and "Authorities," the table has a search filter and the
  header row "sticks" to the top of the browser window as you scroll
  down.
- The "Search fields" table should be sortable, but the other two should
  not--they have drag-and-drop row reordering.

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>
3 years agoBug 27681: Style OPAC self-registration CAPTCHA as uppercase
Owen Leonard [Thu, 11 Feb 2021 13:08:35 +0000 (13:08 +0000)]
Bug 27681: Style OPAC self-registration CAPTCHA as uppercase

This patch adds an inline "text-transform:uppercase" style attribute to
the OPAC self-registration CAPTCHA field so that the user doesn't have
to match the case of the CAPTCHA they're shown.

To test, apply the patch and start the process of self-registration in
the OPAC.

- At the end of the form, under verification, confirm that any text you
  type in the verification field is uppercase by default.
- Confirm that the CAPTCHA is accepted when you submit the form.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27728: Add a search box on OPAC Search history
Owen Leonard [Fri, 19 Feb 2021 12:40:01 +0000 (12:40 +0000)]
Bug 27728: Add a search box on OPAC Search history

This patch makes changes to the OPAC search history DataTables
configuration so that table controls appear, including search, copy,
CSV, and print.

The patch also makes some improvements to the checkbox interactions: The
date column is now a label for the checkbox, and the "Remove selected
searched" button is now disabled until a checkbox has been checked.

To test, apply the patch and log into the OPAC as a user with a search
history. If possible, past and current searches of both bibliographic
and authority records.

- On the search history page, confirm that the DataTables controls
  appear above each table: "Current" and "Previous" under both the
  "Catalog" and "Authority" tabs.
- All controls should work correctly and affect only the corresponding
  table: Search, Clear filter, Copy, CSV, and Print.
- Confirm that clicking a date in the date column checks the correct
  checkbox.
- Confirm that toggling a checkbox correctly enables and disables the
  "Remove selected searches" button as well as the "Select searches to:"
  menu at the top of the table.

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>
3 years agoBug 27855: (QA follow-up) Rename extended_attribute to patron_extended_attribute
Martin Renvoize [Thu, 4 Mar 2021 11:59:37 +0000 (11:59 +0000)]
Bug 27855: (QA follow-up) Rename extended_attribute to patron_extended_attribute

This path renames the extended_attribute definition to
patron_extended_attribute to clarify that these attributes are always
attached to a patron and not a more generic class of attributes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27855: Add 'extended_attributes' embedding to the spec
Tomas Cohen Arazi [Thu, 4 Mar 2021 09:45:47 +0000 (06:45 -0300)]
Bug 27855: Add 'extended_attributes' embedding to the spec

This patch just adds:
- The optional 'extended_attribute' attribute to the patron object
  OpenAPI definition. It consists of an array of extended_attribute
  objects.
- Add the x-koha-embed: [ 'extended_attributes' ] definition on the GET
  routes for patrons, allowing immedite availability of the
  'extended_attributes' embedding feature.

To test:
1. Apply this patchset
2. Restart Plack
3. Have some known patron_id/borrowernumber that has some extended
   attributes ('Patron attributes' on the UI).
4. Enable Basic authentication
5. Assuming the known patron_id is 1, point your favourite REST tool to http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/1
   e.g.: if your user/pass is koha/koha
   curl --location --request GET 'http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/1' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Basic a29oYTprb2hh'
=> SUCCESS: You get the patron object correctly, no extended_attributes
6. Repeat 5, adding the x-koha-embed header like this:
   curl --location --request GET 'http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/1' \
        --header 'Content-Type: application/json' \
        --header 'x-koha-embed: extended_attributes' \
        --header 'Authorization: Basic a29oYTprb2hh'
=> SUCCESS: You get the patron, with the extended attributes inside!
7. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27855: Make GET /patrons/:patron_id use objects.find
Tomas Cohen Arazi [Thu, 4 Mar 2021 09:43:01 +0000 (06:43 -0300)]
Bug 27855: Make GET /patrons/:patron_id use objects.find

This patch makes the route for fetching a patron use the objects.find
helper instead of a plain Koha::Patrons->find. This gives the controller
embedding superpowers.

To test, we just need to check nothing broke:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27855: Implement Koha::Patron::Attribute->to_api_mapping
Tomas Cohen Arazi [Wed, 3 Mar 2021 19:51:41 +0000 (16:51 -0300)]
Bug 27855: Implement Koha::Patron::Attribute->to_api_mapping

This patch introduces a mapping to render extended attributes on the
API. As they have an ID, and they will generally be used on the
/patrons umbrella, I removed the borrowernumber on the mapping.

Another option would be to add the field, but make it optional. It
really feels redundant, so I take it out for now.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27855: Add extended_attribute OpenAPI spec
Tomas Cohen Arazi [Wed, 3 Mar 2021 19:50:39 +0000 (16:50 -0300)]
Bug 27855: Add extended_attribute OpenAPI spec

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27854: Clean GET /patrons controller
Tomas Cohen Arazi [Wed, 3 Mar 2021 19:37:09 +0000 (16:37 -0300)]
Bug 27854: Clean GET /patrons controller

The controller method was written a lot of time before the enhancements
we added to the objects.search helper, and it is now much easier to
handle the 'restricted' param use case.

No need to do it like that anymore.

This patch fetches the 'restricted' param from the query parameters and
cleans it from the validated data, so we can just pass the resultset to
$c->objects->search as in all other controllers.

And we had tests for the expected behavior, so testing this is as easy
as:

1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass! Of course!
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26636: (QA follow-up) Handle no results correctly
Tomas Cohen Arazi [Tue, 2 Feb 2021 19:39:40 +0000 (16:39 -0300)]
Bug 26636: (QA follow-up) Handle no results correctly

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26636: Regression tests for undef case
Tomas Cohen Arazi [Tue, 2 Feb 2021 19:28:07 +0000 (16:28 -0300)]
Bug 26636: Regression tests for undef case

This patch adds tests for the case in which there's no object identified
by the supplied $id. It should return undef.

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26636: (QA follow-up) Add POD
Tomas Cohen Arazi [Tue, 2 Feb 2021 19:22:07 +0000 (16:22 -0300)]
Bug 26636: (QA follow-up) Add POD

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26636: Add objects.find helper
Agustin Moyano [Fri, 9 Oct 2020 13:20:33 +0000 (10:20 -0300)]
Bug 26636: Add objects.find helper

This patch adds the objects.find helper. Much like objects.search, it
returns the to_api method with embedded.

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26636: Add tests
Agustin Moyano [Fri, 9 Oct 2020 14:53:43 +0000 (11:53 -0300)]
Bug 26636: Add tests

This patch adds tests for the new objects.find helper.

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24359: (QA follow-up) Fix tests
Tomas Cohen Arazi [Mon, 1 Mar 2021 18:41:21 +0000 (15:41 -0300)]
Bug 24359: (QA follow-up) Fix tests

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

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

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24359: Remove hold from holds queue when captured
Agustin Moyano [Wed, 28 Oct 2020 13:48:18 +0000 (10:48 -0300)]
Bug 24359: Remove hold from holds queue when captured

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

To test:

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24359: Add test
Agustin Moyano [Wed, 28 Oct 2020 13:48:09 +0000 (10:48 -0300)]
Bug 24359: Add test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27863: Use the /libraries route when AllowHoldsPolicyOverride is set
Tomas Cohen Arazi [Fri, 5 Mar 2021 18:17:56 +0000 (15:17 -0300)]
Bug 27863: Use the /libraries route when AllowHoldsPolicyOverride is set

This patch makes the dropdown for changing the pickup location for
existing holds use the GET /libraries route instead of GET
/holds/:hold_id/pikcup_locations if the configuration allows the
override.

Terminology:
- Pickup location, means a library that is marked as valid pickup
  location on its configuration.

To test:
1. Have the circ rules set so 'Hold pickup library match' is set to
   'Item's home library' or 'Any'. The goal is to be able to
   differentiate when all libraries are returned, from the case only
   'valid pickup locations' are returned. The easiest one is 'Item's
   home library'.
2. Set AllowHoldsPolicyOverride
3. Pick a patron from a library that is not a valid pickup location and
   an item that belongs to a library that doesn't match any of the valid
   ones.
=> SUCCESS: Notice Koha allows you to choose any library (because of the
        syspref)
4. Place the hold.
5. Now check on the holds list for the bib, if you can use the dropdown
   to change the pickup location for the hold
=> SUCCESS: You can, sort of
=> FAIL: It doesn't show/search all pickup locations. It only shows the
        valid ones, even though we should be able to override it.
6. Apply this patch
7. Restart all just in case, and reload the holds page for the bib
8. Repeat 5
=> SUCCESS: You are presented all pickup locations!
9. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26964: Newly created macros should be selected in the Advanced editor
Phil Ringnalda [Fri, 26 Feb 2021 21:39:37 +0000 (13:39 -0800)]
Bug 26964: Newly created macros should be selected in the Advanced editor

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

Test plan:

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

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27058: Add test for IsAvailableForItemLevelRequest and notforloan
Jonathan Druart [Fri, 5 Mar 2021 13:49:22 +0000 (14:49 +0100)]
Bug 27058: Add test for IsAvailableForItemLevelRequest and notforloan

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

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

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

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

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

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

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

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

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

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

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

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

GetNewsToDisplay returns an arrayref

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

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27886: Move non-rancor code into correct section
Nick Clemens [Sat, 6 Mar 2021 16:02:34 +0000 (16:02 +0000)]
Bug 27886: Move non-rancor code into correct section

The template was including code that was not compatible with Rancor, moving
the end of the conditional seems to fix the error

To test:
1 - Open a record in the advanced catalog editor
2 - Create or edit a 100 field with some content, I used 'bruce'
3 - Press Ctrl+shift+l to launch authority search
4 - Perform a search and select an authority
5 - Note the field copies but the pop-ups don't close
6 - Apply patch
7 - Reload the page
8 - Repeat 1-4
9 - The field copies and the windows close

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>
3 years agoBug 27851: Use filter_by_todays_checkins in members/readingrec.pl
Jonathan Druart [Fri, 5 Mar 2021 10:45:12 +0000 (11:45 +0100)]
Bug 27851: Use filter_by_todays_checkins in members/readingrec.pl

Test plan:
Do some checkouts
Checkin with different return dates (several today however)
Check the circulation history and confirm that the checkout list is correct

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27851: Use filter_by_todays_checkins in printslip.pl
Jonathan Druart [Fri, 5 Mar 2021 10:44:42 +0000 (11:44 +0100)]
Bug 27851: Use filter_by_todays_checkins in printslip.pl

Test plan:
No regression from bug 12224 test plan

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27851: Add Koha::Old::Checkouts->filter_by_todays_checkins
Jonathan Druart [Fri, 5 Mar 2021 10:43:46 +0000 (11:43 +0100)]
Bug 27851: Add Koha::Old::Checkouts->filter_by_todays_checkins

The logic for this code is handled at two different places (and in 2
different ways).
Better to centralize and provide tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27851: Add tests
Jonathan Druart [Fri, 5 Mar 2021 10:43:21 +0000 (11:43 +0100)]
Bug 27851: Add tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: DBRev 20.12.00.022
Jonathan Druart [Fri, 5 Mar 2021 12:53:34 +0000 (12:53 +0000)]
Bug 12224: DBRev 20.12.00.022

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: (follow-up) Format today with KohaDates
Katrin Fischer [Fri, 5 Mar 2021 11:29:41 +0000 (12:29 +0100)]
Bug 12224: (follow-up) Format today with KohaDates

Updates the slip templates to use [% today | $KohaDates %].
Adding an explicit USE statement is not necessary in this case.

To test:
- When testing the feature according to the test plan, make sure
  that the date for today shows up formatted to the DateFormat
  system preference.

Note: As we are printing today's checkins, I have intentionally left
oft the time. But it could be easily added if a library wanted it.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: Some code improvements
Jonathan Druart [Wed, 3 Mar 2021 15:44:52 +0000 (16:44 +0100)]
Bug 12224: Some code improvements

* Use Koha::Patrons->old_checkouts
* perltidy
* Make sure $today_start and $today_end will always be on the same day
(we never know!)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: (QA follow-up) Ensure patron language is respected
Martin Renvoize [Wed, 24 Feb 2021 10:21:36 +0000 (10:21 +0000)]
Bug 12224: (QA follow-up) Ensure patron language is respected

Things have moved on a bit since this code was first written, we now
expect a 'lang' parameter passed into GetPrepparedLetter to allow for
translated notices.

Simple fix, so a quick QA follow-up will suffice :)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: (follow-up) Loop old_issues with itemnumber
Aleisha Amohia [Sun, 31 Jan 2021 22:11:51 +0000 (11:11 +1300)]
Bug 12224: (follow-up) Loop old_issues with itemnumber

Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: (follow-up) Switching to TT notice
Aleisha Amohia [Wed, 2 Dec 2020 22:04:23 +0000 (11:04 +1300)]
Bug 12224: (follow-up) Switching to TT notice

Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: (follow-up) Access old_issues table when editing notice
Aleisha Amohia [Mon, 21 Sep 2020 21:37:34 +0000 (09:37 +1200)]
Bug 12224: (follow-up) Access old_issues table when editing notice

This QA follow-up allows access to the old_issues table when editing the
notice in Tools.

Signed-off-by: Alexandra Speer <alexandra.speer@bsz-bw.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: (follow-up) Move button to patron column in checkins table
Owen Leonard [Fri, 18 Sep 2020 13:53:29 +0000 (13:53 +0000)]
Bug 12224: (follow-up) Move button to patron column in checkins table

This patch moves the "Print checkin slip" out of its own column and into
the colum containing patron information. I think this makes more sense
because the slip is specific to a patron, not the individual item which
has been checked in.

Also changed: printcheckinslip function should be triggered via a class,
not a non-unique ID. The function should handle the click using
"preventDefault" rather than "return false."

To test, apply the patch and check in some items checked out to various
patrons.

- In the table of checked-in items, confirm that the "Print checkin
  slip" appears correctly in the column of patron information.
- Confirm that the button works correctly to print the correct slip for
  the associated patron.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Alexandra Speer <alexandra.speer@bsz-bw.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 12224: Print a slip of borrower's checkins for today
Aleisha Amohia [Thu, 17 Sep 2020 23:58:05 +0000 (11:58 +1200)]
Bug 12224: Print a slip of borrower's checkins for today

To test:

1) Apply patch and run installer
2) Check out two items (or more) to a borrower
3) Check in two items (or more) for this borrower (you should end up on
    circ/returns.pl)
4) Notice the checked-in items table has started building. There should
be a new column with the button 'Print checkin slip' in each row.
5) Click the button and confirm the checkin slip opens for printing in a
new window.
6) Go to the patron's account
7) Click the Print dropdown. Confirm there is a 'Print checkin slip'
option. Click this and confirm the checkin slip opens for printing in a
new window.

Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Alexandra Speer <alexandra.speer@bsz-bw.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27745: prevent warning for uninitialized value as a hash key
Petro Vashchuk [Wed, 3 Mar 2021 09:32:48 +0000 (11:32 +0200)]
Bug 27745: prevent warning for uninitialized value as a hash key

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27410: (follow-up) Updates to accommodate currency entry
Owen Leonard [Thu, 21 Jan 2021 14:40:52 +0000 (14:40 +0000)]
Bug 27410: (follow-up) Updates to accommodate currency entry

This patch makes two modifications in order to allow the entry of
currency strings (e.g. 1.25).

 - Inputmode changed to "decimal"
 - Regex pattern changed to "^\d+(\.\d{2})?$" as found in
   admin/debit_types.tt

To test, apply the patch and test entry of various strings in the manual
invoice "amount" field. Confirm that the field only accepts digits or
digits followed by a decimal and two digits.

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>
3 years agoBug 27410: Update intranet-tmpl/prog/en/modules/members/maninvoice.tt to reflect...
Mazen Khallaf [Tue, 19 Jan 2021 09:36:34 +0000 (09:36 +0000)]
Bug 27410: Update intranet-tmpl/prog/en/modules/members/maninvoice.tt to reflect ACC2

Test Plan:
1. Open intranet-tmpl/prog/en/modules/members/maninvoice.tt
2. Search for instances of 'input type="number"'
3. If none are found then patch was successful

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
3 years agoBug 27408: (follow-up) Updates to accommodate currency entry
Owen Leonard [Thu, 21 Jan 2021 14:29:03 +0000 (14:29 +0000)]
Bug 27408: (follow-up) Updates to accommodate currency entry

This patch makes two modifications in order to allow the entry of
currency strings (e.g. 1.25).
- Inputmode changed to "decimal"
- Regex pattern changed to "^\d+(\.\d{2})?$" as found in
  admin/debit_types.tt

To test, apply the patch and test entry of various strings in the manual
credit "amount" field. Confirm that the field only accepts digits or
digits followed by a decimal and two digits.

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>
3 years agoBug 27408: Update intranet-tmpl/prog/en/modules/members/mancredit.tt for ACC2
Mazen Khallaf [Tue, 19 Jan 2021 09:45:34 +0000 (09:45 +0000)]
Bug 27408: Update intranet-tmpl/prog/en/modules/members/mancredit.tt for ACC2

Test Plan:

1. Open intranet-tmpl/prog/en/modules/members/mancredit.tt
2. Search for instances of 'input type="text"
3. If none are found then patch was successful

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
3 years agoBug 27668: Compiled CSS
Jonathan Druart [Fri, 5 Mar 2021 12:15:51 +0000 (13:15 +0100)]
Bug 27668: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27668: Improve validation of patron entry form in the OPAC
Owen Leonard [Wed, 10 Feb 2021 19:43:25 +0000 (19:43 +0000)]
Bug 27668: Improve validation of patron entry form in the OPAC

This patch improves the way we handle required fields in the patron
entry/update form in the OPAC. Instead of doing multiple checks for each
field using mandatory.defined(), the template now loops over a list of
fields and sets a "required" variable for any which are required.

Then, for each form field, the "required" variable is used to set
classes on labels, input fields, and the "required" text hints. The
class on form fields acts as a hook for the jQuery validator plugin. The
class on the text hints allows us to hide the text hint using CSS,
eliminating the necessity of using a template conditional.

The patch also adds the missing validator-strings include which enables
translation of the jQuery validator plugin's validation error messages.

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).

 - Go to Administration -> System preferences and enable
   PatronSelfRegistration.
 - Select multiple fields to be required using the
   PatronSelfRegistrationBorrowerMandatoryField preference.
 - In the OPAC, start the process of registering for an account.
 - The fields you designated as mandatory should each have a "Required"
   label under them.
 - Try to submit the form without entering any data. The required fields
   should now be highlighted in red and have another label, "This field
   is  required."
 - Fill in the required fields and submit the form. It should submit
   correctly.
 - Modify the PatronSelfRegistrationBorrowerMandatoryField preference
   and select all fields as mandatory. Confirm that all fields in the
   patron entry form work correctly.
 - Test that form validation works correctly when modifying a logged-in
   patron's existing account.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27777: (alternate) Improve tables on Point of Sale page for low screen resolutions
Owen Leonard [Wed, 24 Feb 2021 16:58:28 +0000 (16:58 +0000)]
Bug 27777: (alternate) Improve tables on Point of Sale page for low screen resolutions

This alternate solution makes these minor changes:

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

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

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

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

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

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

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

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

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25674: Remove default vhost
Jonathan Druart [Mon, 11 Jan 2021 09:04:07 +0000 (10:04 +0100)]
Bug 25674: Remove default vhost

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25674: Add documentation
Tomas Cohen Arazi [Mon, 4 Jan 2021 16:15:08 +0000 (13:15 -0300)]
Bug 25674: Add documentation

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25674: Adapt koha-create
Tomas Cohen Arazi [Mon, 4 Jan 2021 16:14:52 +0000 (13:14 -0300)]
Bug 25674: Adapt koha-create

This patch adds the following option switches to koha-create:

--mb-host
--mb-port
--mb-user
--mb-pass
--mb-vhost

They are used to override the default values on instance creation.

To test:
1. Play with the several option switches and verify that the resulting
   koha-conf.xml contains the expected data.
=> SUCCESS: It works as expected
2. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>