koha.git
2 years agoBug 13952: Import and export authority types
Aleisha [Tue, 26 Jan 2016 23:39:26 +0000 (23:39 +0000)]
Bug 13952: Import and export authority types

This patch amends C4::ImportExportFramework to work for authority types as well as MARC frameworks.
New file: admin/import_export_authtype.pl
Update: Ensuring we are passing the right column to the right tables.
Update2: Making the error messages the same to be consistent with patch on Bug 15665
Update3: Fixing merge conflicts
Update4: Fixing merge conflicts and removing tabs
Update5: Getting rid of warns, making sure Import and Export of default
authority will work
Update6: Merge conflicts and making sure export of default auth type
works
Update7: Fixing merge conflicts and updating buttons to bootstrap3

To test:
1) Go to Admin -> Authority types
2) Confirm there are two new columns 'Export' and 'Import' in the table
3) Click 'Export' on an existing authority type and choose a file type, click 'Export'
4) Confirm that the authority type is exported as your chosen file type. Save the file
5) Create a new authority type
6) Import into your new authority type using the file you just exported
7) Confirm you are taken to auth_tag_structure.pl
8) Go back to Authority types
9) Export your new authority type. View the exported file and confirm
the authtypecode has been updated to match the code you set for the new
auth type
10) Click 'Import' next to any existing authority type and attempt to import a file that is not XML, CSV or ODS. Confirm that this fails and you are asked to import a file of the correct file type
11) Confirm Export and Import work for the Default authority type
12) Go to Admin -> MARC bibliographic framework
13) Confirm that the 'Export' and 'Import' functions still work here as well

Sponsored-by: Catalyst IT
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Mazen Khallaf <mazen.i.khallaf@gamil.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30222: Remove warning
Jonathan Druart [Fri, 25 Mar 2022 08:05:18 +0000 (09:05 +0100)]
Bug 30222: Remove warning

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

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

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

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

Follow test plan on previous patches

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

https://bugs.koha-community.org/show_bug.cgi?id=29576
Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29517: Check if agerestriction field is mapped before fetching biblio
Nick Clemens [Thu, 18 Nov 2021 12:03:36 +0000 (12:03 +0000)]
Bug 29517: Check if agerestriction field is mapped before fetching biblio

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

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

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30114: Koha offline circulation will always cancel the next hold when issuing...
Kyle Hall [Tue, 15 Feb 2022 16:33:33 +0000 (11:33 -0500)]
Bug 30114: Koha offline circulation will always cancel the next hold when issuing item to a patron

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoRevert "Bug 30425: April fools 🐟: Add ponies to staff homepage"
Fridolin Somers [Mon, 4 Apr 2022 07:46:47 +0000 (09:46 +0200)]
Revert "Bug 30425: April fools 🐟: Add ponies to staff homepage"

This reverts commit 68b56685c74779a2859e13cbccf340c892544d2d.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Compiled CSS
Fridolin Somers [Fri, 1 Apr 2022 08:18:22 +0000 (10:18 +0200)]
Bug 30063: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30404: Enlarge all patron search pop-ups
Jonathan Druart [Thu, 31 Mar 2022 08:30:22 +0000 (10:30 +0200)]
Bug 30404: Enlarge all patron search pop-ups

Enlarging the pop-ups will hide the scrollbars (at least the horizontal
one).

Test plan:
Search for patrons (when a new pop-up is opened) and confirm that the
pop-up is bigger than without this patch.

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Fix QA issues
Jonathan Druart [Thu, 31 Mar 2022 12:43:50 +0000 (14:43 +0200)]
Bug 30063: Fix QA issues

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Sort by "Name" surname:firstname
Jonathan Druart [Wed, 30 Mar 2022 15:31:38 +0000 (17:31 +0200)]
Bug 30063: Sort by "Name" surname:firstname

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Fix permission for GET /patrons
Jonathan Druart [Wed, 30 Mar 2022 11:37:40 +0000 (13:37 +0200)]
Bug 30063: Fix permission for GET /patrons

edit_borrowers should be enough, we don't need the whole borrowers
module flag

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Fix start with
Jonathan Druart [Wed, 30 Mar 2022 11:34:01 +0000 (13:34 +0200)]
Bug 30063: Fix start with

It was doing "end with"...

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Restore back behaviour
Jonathan Druart [Wed, 30 Mar 2022 11:02:07 +0000 (13:02 +0200)]
Bug 30063: Restore back behaviour

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Sort by "Name" firstname,surname
Jonathan Druart [Wed, 30 Mar 2022 08:28:34 +0000 (10:28 +0200)]
Bug 30063: Sort by "Name" firstname,surname

As it's how it's displayed

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Fix table settings
Jonathan Druart [Tue, 29 Mar 2022 08:28:43 +0000 (10:28 +0200)]
Bug 30063: Fix table settings

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Be more flexible for filters
Jonathan Druart [Wed, 23 Mar 2022 16:36:50 +0000 (17:36 +0100)]
Bug 30063: Be more flexible for filters

On later follow-ups (ERM) we need to filter columns that contain AVs,
and so be more flexible. Here we are expecting a _id and _str keys we
are gonna use to build the select's options

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Add selenium tests
Jonathan Druart [Thu, 17 Feb 2022 11:38:29 +0000 (12:38 +0100)]
Bug 30063: Add selenium tests

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Fix sticky
Jonathan Druart [Tue, 15 Feb 2022 16:08:05 +0000 (17:08 +0100)]
Bug 30063: Fix sticky

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Fix selenium tests
Jonathan Druart [Tue, 15 Feb 2022 11:28:23 +0000 (12:28 +0100)]
Bug 30063: Fix selenium tests

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Display search description for main search only
Jonathan Druart [Tue, 15 Feb 2022 10:18:09 +0000 (11:18 +0100)]
Bug 30063: Display search description for main search only

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Add kind of POD for the include file
Jonathan Druart [Mon, 14 Feb 2022 16:33:43 +0000 (17:33 +0100)]
Bug 30063: Add kind of POD for the include file

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Fix address format
Jonathan Druart [Mon, 14 Feb 2022 16:13:53 +0000 (17:13 +0100)]
Bug 30063: Fix address format

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Remove occurrences of C4::Utils::DataTables::Members
Jonathan Druart [Mon, 14 Feb 2022 14:15:30 +0000 (15:15 +0100)]
Bug 30063: Remove occurrences of C4::Utils::DataTables::Members

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Remove svc/members/search
Jonathan Druart [Mon, 14 Feb 2022 10:16:26 +0000 (11:16 +0100)]
Bug 30063: Remove svc/members/search

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Make the main patron search use the REST API
Jonathan Druart [Fri, 11 Feb 2022 13:03:36 +0000 (14:03 +0100)]
Bug 30063: Make the main patron search use the REST API

To test:
* Length menu (PatronsPerPage)
* Query description
* Highlight of the current library

* sticky header - Does not work (?)

If the table does not show when you submit the filter form, make sure
you regenerated the compiled CSS.

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Overdues count
Jonathan Druart [Fri, 11 Feb 2022 09:58:14 +0000 (10:58 +0100)]
Bug 30063: Overdues count

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30063: Number of checkouts
Jonathan Druart [Fri, 11 Feb 2022 08:39:12 +0000 (09:39 +0100)]
Bug 30063: Number of checkouts

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30094: (QA follow-up) Mke the QA script happy
Martin Renvoize [Thu, 31 Mar 2022 12:33:42 +0000 (13:33 +0100)]
Bug 30094: (QA follow-up) Mke the QA script happy

Remove newlines from a template block

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30094: Make the patron search from request-article.pl use the REST API
Jonathan Druart [Mon, 14 Feb 2022 14:13:17 +0000 (15:13 +0100)]
Bug 30094: Make the patron search from request-article.pl use the REST API

Reuse what has been done before to implement the patron search using the
REST API route, when requesting an article

Test plan:
Request an article for a patron and confirm that the search is working
correctly.

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30093: Fix QA failures
Jonathan Druart [Thu, 31 Mar 2022 11:44:16 +0000 (13:44 +0200)]
Bug 30093: Fix QA failures

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30093: Restore the autocomplete feature
Jonathan Druart [Mon, 21 Feb 2022 10:56:06 +0000 (11:56 +0100)]
Bug 30093: Restore the autocomplete feature

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30093: Make patron search from request.pl use the REST API
Jonathan Druart [Wed, 9 Feb 2022 15:29:23 +0000 (16:29 +0100)]
Bug 30093: Make patron search from request.pl use the REST API

In this patch we want to reuse what has been done in the previous bug
report to search patrons using the REST API route.
The code is mainly in members/search.tt, for all the patron searches
that "add" or "select" a patron (popup windows).
The patron search for holds is a bit different, we don't want to open a
popup window.
We are moving to code to an include file (patron-search.tt) to make it
reusable easily.

Note that we are improving how the patron's addresses are displayed, and
provide a JS equivalent to the TT includes files.

Test plan:
Search for patrons from the "Place a hold on" view.
You should see the same view as behaviour, with more filters.

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30093: Rename patron-search.inc to patron-search-header.inc
Jonathan Druart [Wed, 9 Feb 2022 15:14:47 +0000 (16:14 +0100)]
Bug 30093: Rename patron-search.inc to patron-search-header.inc

We will use 'patron-search.inc' in the next patch

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Add missing x-koha-embed for /acquisitions/baskets/managers
Jonathan Druart [Wed, 30 Mar 2022 08:14:50 +0000 (10:14 +0200)]
Bug 30055: Add missing x-koha-embed for /acquisitions/baskets/managers

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: (follow-up) Adapt spec for bug 30194
Tomas Cohen Arazi [Tue, 29 Mar 2022 15:26:21 +0000 (17:26 +0200)]
Bug 30055: (follow-up) Adapt spec for bug 30194

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: API unit tests
Tomas Cohen Arazi [Tue, 29 Mar 2022 13:37:59 +0000 (15:37 +0200)]
Bug 30055: API unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: (QA follow-up) Minor QA fixes
Tomas Cohen Arazi [Tue, 29 Mar 2022 10:59:54 +0000 (12:59 +0200)]
Bug 30055: (QA follow-up) Minor QA fixes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: clear the column filter if none selected
Jonathan Druart [Thu, 24 Mar 2022 15:03:50 +0000 (16:03 +0100)]
Bug 30055: clear the column filter if none selected

ie. search for "", not "^$"

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Force exact match for dropdown
Jonathan Druart [Thu, 17 Feb 2022 08:26:02 +0000 (09:26 +0100)]
Bug 30055: Force exact match for dropdown

For libraries and categories we need to use an exact match.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Don't hardcode the default sort column
Jonathan Druart [Thu, 17 Feb 2022 09:57:25 +0000 (10:57 +0100)]
Bug 30055: Don't hardcode the default sort column

At this point it does not change anything, all calls to
members/search.pl has "name" in second column, but that will be helpful
in follow-up bugs.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: (follow-up) Add missing embeds
Jonathan Druart [Thu, 17 Feb 2022 07:30:03 +0000 (08:30 +0100)]
Bug 30055: (follow-up) Add missing embeds

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: (follow-up) Increase popup window size
Martin Renvoize [Tue, 15 Feb 2022 11:22:02 +0000 (11:22 +0000)]
Bug 30055: (follow-up) Increase popup window size

With the required addition of fields to the displayed result table, we
need to increase the size of the popover window to prevent horizontal
scrolling.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Missing search on othernames
Jonathan Druart [Fri, 11 Feb 2022 13:06:58 +0000 (14:06 +0100)]
Bug 30055: Missing search on othernames

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Restore DefaultPatronSearchFields and fix extended attrs search
Jonathan Druart [Fri, 11 Feb 2022 13:49:51 +0000 (14:49 +0100)]
Bug 30055: Restore DefaultPatronSearchFields and fix extended attrs search

We lost the DefaultPatronSearchFields behaviour, we don't want to search
on all data but only DefaultPatronSearchFields

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Fix when there is no searchable attr type
Jonathan Druart [Fri, 11 Feb 2022 12:17:47 +0000 (13:17 +0100)]
Bug 30055: Fix when there is no searchable attr type

No idea why we need that.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Add missing spec file for baskets
Jonathan Druart [Fri, 11 Feb 2022 12:10:53 +0000 (13:10 +0100)]
Bug 30055: Add missing spec file for baskets

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Put extended attributes search back
Jonathan Druart [Thu, 10 Feb 2022 17:00:22 +0000 (18:00 +0100)]
Bug 30055: Put extended attributes search back

Last patches remove the ability to search on extended attributes.
C4::Utils::DataTables::Members::search is searching on all the
attributes that are flagged as "searchable", we want to keep this
behaviour.

I have tried several things and this is the simplest I have found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Add missing include to format addresses
Jonathan Druart [Wed, 9 Feb 2022 15:30:23 +0000 (16:30 +0100)]
Bug 30055: Add missing include to format addresses

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Restore patron's preview links
Jonathan Druart [Wed, 9 Feb 2022 14:48:15 +0000 (15:48 +0100)]
Bug 30055: Restore patron's preview links

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Prevent blink when page is loading
Jonathan Druart [Wed, 9 Feb 2022 14:35:00 +0000 (15:35 +0100)]
Bug 30055: Prevent blink when page is loading

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Adjust hint about permissions
Jonathan Druart [Wed, 9 Feb 2022 12:02:41 +0000 (13:02 +0100)]
Bug 30055: Adjust hint about permissions

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: /api/v1/acquisitions/funds/owners and users for funds
Jonathan Druart [Wed, 9 Feb 2022 11:58:28 +0000 (12:58 +0100)]
Bug 30055: /api/v1/acquisitions/funds/owners and users for funds

Two new routes that do the same thing
/api/v1/acquisitions/funds/owners
/api/v1/acquisitions/funds/users
To list the possible owners and users for a fund

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Use /acquisitions/baskets/managers for basket's manager
Jonathan Druart [Wed, 9 Feb 2022 11:38:18 +0000 (12:38 +0100)]
Bug 30055: Use /acquisitions/baskets/managers for basket's manager

Test plan:
Add a manager to a basket

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Use /patrons for neworderempty
Jonathan Druart [Wed, 9 Feb 2022 11:22:49 +0000 (12:22 +0100)]
Bug 30055: Use /patrons for neworderempty

Test plan:
Create or edit an order, add users to notify on receiving

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Use /patrons for routing list
Jonathan Druart [Wed, 9 Feb 2022 11:15:33 +0000 (12:15 +0100)]
Bug 30055: Use /patrons for routing list

Test plan:
Add new users to a serial routing list

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Use /patrons for patron's cards
Jonathan Druart [Wed, 9 Feb 2022 11:03:47 +0000 (12:03 +0100)]
Bug 30055: Use /patrons for patron's cards

Test plan:
Create a new card batch and add new borrowernumber using the "Add
patron(s)" button.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Use /api/v1/suggestions/managers to list managers or suggestions
Jonathan Druart [Wed, 9 Feb 2022 09:24:35 +0000 (10:24 +0100)]
Bug 30055: Use /api/v1/suggestions/managers to list managers or suggestions

Test plan:
Select a manager for a suggestion

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30055: Make patron searches use the REST API
Jonathan Druart [Wed, 2 Feb 2022 17:00:58 +0000 (18:00 +0100)]
Bug 30055: Make patron searches use the REST API

This patch will rewrite some of our patron searches to make them use the
REST API routes (and so the powerful the DataTables wrapper which will
bring all the nice DT feature to filter, sort, etc.)

The patron searches we will take into account here are those that we use
to select a patron in a pop-up:
 * Guarantor
 * Suggestion's manager
 * Patron's card
 * Serial routing list
 * Users to notify when order is received
 * Manager of an acquisition basket
 * Owner and users of a fund

Regarding permissions there are two main problematics:
 * Filter a patron set by patrons having a
specific subpermissions (in case of adding a manager to a suggestion or
when we deal with acquisition and funds). We added a new
Koha::Patrons->filter_by_have_subpermission method that will take in
parameter a subpermission. To make thing transparent for the callers we
are adding new routes, like /suggestions/managers to list the possible
managers of suggestions.
 * Restrict/allow access to the default patron searches /patrons
We need to access it when a logged in patron does not have borrowers
permission.
Ideally we need a separate "search_borrowers" subpermissions but it's
considered outside the scope of this change.

For each patch you will take care of testing the different permissions
that are into effect (either for the logged in patron or the patrons
returned by the search).

The tables should contain the same columns as prior to this patch,
except for "categories" and "library". We have the filter on top of the
page and so we need to add them to the table as new columns if they
weren't there before.

Test plan (for this patch):
Search for guarantor and select

Test plan (for all patches):
Add/Select patrons from the correct place where you can search for
patrons, play extensively with the filters/pagination/etc

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30393: Make datatables wrapper handle searching for %, _, \
Tomas Cohen Arazi [Wed, 30 Mar 2022 10:10:26 +0000 (12:10 +0200)]
Bug 30393: Make datatables wrapper handle searching for %, _, \

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

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30425: April fools 🐟: Add ponies to staff homepage
Victor Grousset/tuxayo [Thu, 31 Mar 2022 21:47:55 +0000 (23:47 +0200)]
Bug 30425: April fools 🐟: Add ponies to staff homepage

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: (follow-up) Fix xt/api.t
Tomas Cohen Arazi [Tue, 29 Mar 2022 15:12:39 +0000 (17:12 +0200)]
Bug 30194: (follow-up) Fix xt/api.t

The query object can have an arbitrary structure, and thus it doesn't
make sense to check for the additionalProperties presence. also, it is
not allowed by OpenAPIv2 :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoRevert "Bug 30194: Add missing additionalProperties to q_body"
Fridolin Somers [Tue, 29 Mar 2022 15:01:24 +0000 (17:01 +0200)]
Revert "Bug 30194: Add missing additionalProperties to q_body"

This reverts commit 6d33682c13a4b5c46be5ddb23894c4196b831f92.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: Add missing additionalProperties to q_body
Martin Renvoize [Tue, 29 Mar 2022 14:03:56 +0000 (15:03 +0100)]
Bug 30194: Add missing additionalProperties to q_body

This gets xt/api.t passing again.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: (follow-up) Remove reference to swagger-v2-schema
Martin Renvoize [Thu, 24 Mar 2022 10:30:33 +0000 (10:30 +0000)]
Bug 30194: (follow-up) Remove reference to swagger-v2-schema

This file is now bundled directly an no longer needs to be refered to
separately.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: (follow-up) Simply OpenAPI Specification
Martin Renvoize [Thu, 24 Mar 2022 10:18:51 +0000 (10:18 +0000)]
Bug 30194: (follow-up) Simply OpenAPI Specification

This patch simplifies the specification directory further by doing the
following:

* Inlines paths.yml into swagger.yaml
* Inlines definitions.yaml into swagger.yaml
* Inlines parameters.yaml into swagger.yaml
* Drops x-primitives.yaml

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: Auto generate swagger.yaml
Jonathan Druart [Thu, 24 Mar 2022 07:54:59 +0000 (08:54 +0100)]
Bug 30194: Auto generate swagger.yaml

It was not sorted correct and had inconsistencies.

use YAML;
use File::Slurp qw( write_file );
my $hash = YAML::LoadFile('api/v1/swagger/swagger.yaml');
YAML::Bless($hash)->keys([qw(swagger basePath definitions parameters paths info tags)]);
my $info = $hash->{info};
YAML::Bless($info)->keys([qw(title version license contact description)]);
my $yaml= YAML::Dump($hash);
$yaml =~ s|'|"|xmsg;
write_file('api/v1/swagger/swagger.yaml', $yaml);

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: (26351 follow-up) Silence useless warning
Tomas Cohen Arazi [Tue, 8 Mar 2022 19:08:26 +0000 (16:08 -0300)]
Bug 30194: (26351 follow-up) Silence useless warning

Every place in which Koha::Plugin::Test is loaded, and a patron is
updated, this hook needs to be silenced.

To reproduce:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t
=> FAIL: There's a warn about patron_barcode_transform
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Mason James <mtj@kohaaloha.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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: (follow-up) Remove invalid tests
Tomas Cohen Arazi [Tue, 8 Mar 2022 18:43:28 +0000 (15:43 -0300)]
Bug 30194: (follow-up) Remove invalid tests

This patch removes tests for the wrong 'Accept' header situation. It is
the only thing I found I could do.

The situation is: the JSON::Validator + Mojolicious::Plugin::OpenAPI is
trapping this case and returning its own error code (400) and it also
builds its own message! So no point testing it, as it can change again.

I post it as a separate patch just in case someone finds a better way to
handle this and obsoletes the patch :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Mason James <mtj@kohaaloha.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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: Fix invalid spec
Tomas Cohen Arazi [Tue, 8 Mar 2022 15:57:02 +0000 (12:57 -0300)]
Bug 30194: Fix invalid spec

This patch fixes a problem with the spec.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Mason James <mtj@kohaaloha.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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30194: Adapt Koha to the latest JSON::Validator version
Tomas Cohen Arazi [Tue, 8 Mar 2022 15:56:48 +0000 (12:56 -0300)]
Bug 30194: Adapt Koha to the latest JSON::Validator version

This patch makes V1.pm and PluginRoutes.pm work with the
JSON::Validator breaking changes introduced after v4.

JSON::Validator got stricter, and it seems there's some bug in how it
resolves references, so I propose we bundle the YAML spec into a single
file using a gulp task. This will save load time too, so has its
advantages too.

To test:
1. Edit /etc/apt/sources.list.d/koha.list
2. Duplicate the existing line below, replacing 'dev' for 'exp'
3. Upgrade the packages
   $ apt update ; apt dist-upgrade -y
4. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t \
           t/db_dependent/api/v1
=> SUCCESS: Tests pass!
5. Restart plack and check the logs:
   $ koha-plack --restart kohadev ; tail -f /var/log/koha/kohadev/*.log
=> SUCCESS: Nothing seems broken, things work
6. Point your browser to http://localhost:8081/api/v1/
=> SUCCESS: The API is loaded
7. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Mason James <mtj@kohaaloha.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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 19532: (follow-up) Fix installer data for unimarc
Arthur Suzuki [Mon, 28 Mar 2022 10:00:13 +0000 (12:00 +0200)]
Bug 19532: (follow-up) Fix installer data for unimarc

https://bugs.koha-community.org/show_bug.cgi?id=19532
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30276: (bug 30060 follow-up) Fix 21.12.00.016
Jonathan Druart [Mon, 28 Mar 2022 12:01:26 +0000 (14:01 +0200)]
Bug 30276: (bug 30060 follow-up) Fix 21.12.00.016

ERROR 1832 (HY000): Cannot change column 'code': used in a foreign key constraint 'user_permissions_ibfk_2'

Test plan:
Checkout a commit prior to 30060 (c023f63abcce53d71c9492aea4bc7aa30fdc5d73)
reset_all
checkout master+this patch
updatedatabase

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30244: Include lost items in list of hidden items
Nick Clemens [Fri, 11 Mar 2022 14:24:27 +0000 (14:24 +0000)]
Bug 30244: Include lost items in list of hidden items

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

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

This patch simply adds the lost itemnumbers to the list

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

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

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

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

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

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

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

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

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

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

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

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

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

Plan test:

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

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

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

4. Change your current desk.

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

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

7. Apply patch.

8. Check in again the item.

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

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28416: Delay load of Email::Sender::Transport::SMTP
Jonathan Druart [Fri, 21 May 2021 12:10:56 +0000 (14:10 +0200)]
Bug 28416: Delay load of Email::Sender::Transport::SMTP

As it's taking 10M of RAM

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24221: (follow-up) Remove id opac-my-summary-note
Fridolin Somers [Fri, 25 Mar 2022 20:39:28 +0000 (10:39 -1000)]
Bug 24221: (follow-up) Remove id opac-my-summary-note

Like in other conversions to news block, we do not need an HTML id in
the template, one is created by PROCESS koha_news_block

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24221: DBRev 21.12.00.020
Fridolin Somers [Fri, 25 Mar 2022 20:37:37 +0000 (10:37 -1000)]
Bug 24221: DBRev 21.12.00.020

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24221: Improve atomic update
Jonathan Druart [Tue, 22 Mar 2022 12:19:24 +0000 (13:19 +0100)]
Bug 24221: Improve atomic update

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24221: Move OPACMySummaryNote to HTML customizations in additional-contents
Lucas Gass [Tue, 1 Mar 2022 17:32:13 +0000 (17:32 +0000)]
Bug 24221: Move OPACMySummaryNote to HTML customizations in additional-contents

To test:
1- Before applying the patch add some content to the system preference OPACMySummaryNote
2- Apply patch
3- restart_all and updatedatabase
4. Go to additional-content.pl ( HTML customizations )
5. You should now see your content from the system preference under OpacMySummaryNote in HTML customizations
6. Try searching for the system preference, OPACMySummaryNote. It has been removed and you should not be able to find it.
7. Try changing/removing/adding content from OpacMySummaryNote in HTML customizations
8. Make sure your edits are reflected when you look at the user summary page

Note: The system preference was named OPACMySummaryNote but in to be more consitent with how we have named other additional_contents I have renamed this OpacMySummaryNote.
Signed-off-by: shiyao <shiyao@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22605: (RM follow-up) Fix test suite
Fridolin Somers [Fri, 25 Mar 2022 20:14:27 +0000 (10:14 -1000)]
Bug 22605: (RM follow-up) Fix test suite

See https://jenkins.koha-community.org/view/master/job/Koha_Master_D10/560/

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30227: Replace the use of jQueryUI tabs on bibliographic detail page
Owen Leonard [Fri, 4 Mar 2022 17:09:40 +0000 (17:09 +0000)]
Bug 30227: Replace the use of jQueryUI tabs on bibliographic detail page

This patch replaces jQueryUI tabs on the bibliographic detail page,
replacing them with Bootstrap tabs.

To test, apply the patch and locate a bibliographic record in the staff
client. Check the tabs on the detail page. Try to test as many
variations as possible:

- With and without holdings
- With and without descriptions (5** note fields)
- With alternate holdings (AlternateHoldingsField preference)
- With HTML5 media (see Preferences -> Enhanced content -> HTML5 media)
- With an associated suggestion
- With an associated subscription
- With acquisition information
- With local cover images
- With SeparateHoldings enabled
- With other editions available (FRBRizeEditions)
- With component parts

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30317: Replace the use of jQueryUI tabs on search history page
Owen Leonard [Fri, 18 Mar 2022 16:06:53 +0000 (16:06 +0000)]
Bug 30317: Replace the use of jQueryUI tabs on search history page

This patch replaces jQueryUI tabs on the staff interface's search
history page, replacing them with Bootstrap tabs.

To test, apply the patch and perform some bibliographic and
authority searches in the staff client if necessary.

Go to the search history page and test that the "Catalog" and
"Authority" tabs work correctly.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30316: Replace the use of jQueryUI tabs on MARC detail page
Owen Leonard [Fri, 18 Mar 2022 15:24:49 +0000 (15:24 +0000)]
Bug 30316: Replace the use of jQueryUI tabs on MARC detail page

This patch replaces jQueryUI tabs on the MARC detail page, replacing
them with Bootstrap tabs.

To test, apply the patch and locate a bibliographic record in the staff
client. View the MARC detail page for that record. Confirm that the
numered tabs work correctly.

JD amended patch: removed commented line
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29998: Replace the use of jQueryUI tabs on item types administration page
Owen Leonard [Thu, 17 Mar 2022 18:21:56 +0000 (18:21 +0000)]
Bug 29998: Replace the use of jQueryUI tabs on item types administration page

This patch updates the item type edit interface so that it uses
Bootstrap tabs instead of jQueryUI tabs for displaying icon sets.

Unrelated: The patch removes an invalid "type" attribute from a <select>
element.

- Go to Administration -> Item types in the staff interface.
- Edit an item type.
- On the edit page you should see tabs under "Choose an icon."
- Confirm that the tabs look correct and work correctly.
- If you did not previously have any icon selected, the "None" tab
  should be active.
- If you had an icon selected, that icon set's tab should be active.
- Confirm that if you specify a remote image (e.g.
  https://via.placeholder.com/50/FF0000/FFFFFF.png ) the tab is
  correctly shown after you save and re-edit.
- Confirm that changing icons works correctly and that the selected
  icon's tab is always active when you return to the edit view.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29999: Compiled CSS
Fridolin Somers [Fri, 25 Mar 2022 07:43:17 +0000 (21:43 -1000)]
Bug 29999: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29999: (follow-up) Show the remote image tab if selected
Owen Leonard [Thu, 17 Mar 2022 18:17:44 +0000 (18:17 +0000)]
Bug 29999: (follow-up) Show the remote image tab if selected

This follow-up corrects the markup so that if a value is entered in the
"Remote image" field, the correct tab will be selected upon page load.

The patch also corrrects the input name on the "No image" field so that
the option works correctly.

To test, apply the patch and edit an authorized value.

- Select an icon from an icon set. Save, and then re-edit.
  - The correct icon set tab should be activated.
- Select "No image," save, and re-edit.
  - The "No image" tab should be selected.
- On the "Remote image" tab, enter a remote image url, e.g.
  https://via.placeholder.com/50/FF0000/FFFFFF.png. Save and re-edit.
- The "Remote image" should be selected.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29999: Replace the use of jQueryUI tabs on authorized values administration page
Owen Leonard [Tue, 1 Feb 2022 19:36:22 +0000 (19:36 +0000)]
Bug 29999: Replace the use of jQueryUI tabs on authorized values administration page

This patch updates the authorized values edit interface so that it uses
Bootstrap tabs instead of jQueryUI tabs for displaying icon sets.

Normally Bootstrap tabs don't have to be initiated via JavaScript, but
this page requires some JS to select the first tab as active if no other
tabs are active. Because of the way the template works it's not simple
to do it via template logic, so in this case some JS helps.

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

- Go to Administration -> Authorized values in the staff interface.
- Select a category and then add or edit an authorized value in that
  category.
  - On the edit page you should see tabs under "Choose an icon."
  - Confirm that the tabs look correct and work correctly.
  - If you did not previously have any icon selected, the "None" tab
    should be active.
  - If you had an icon selected, that icon set's tab should be
    active.
  - Confirm that changing icons works correctly and that the
    selected icon's tab is always active when you return to the edit
    page.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30165: (follow-up) Allow objects.search usage outside OpenAPI
Tomas Cohen Arazi [Thu, 24 Mar 2022 12:52:04 +0000 (09:52 -0300)]
Bug 30165: (follow-up) Allow objects.search usage outside OpenAPI

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

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

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

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>