]> git.koha-community.org Git - koha.git/log
koha.git
2 years agoBug 26669: Adjust POD
Nick Clemens [Wed, 30 Mar 2022 12:25:42 +0000 (12:25 +0000)]
Bug 26669: Adjust POD

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

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

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

Test plan :

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

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

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

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

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

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

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30408: Make API and OpenAPI versions strings in spec
Tomas Cohen Arazi [Wed, 30 Mar 2022 12:07:20 +0000 (14:07 +0200)]
Bug 30408: Make API and OpenAPI versions strings in spec

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30394: Make datatables.js aware of x-koha-request-id
Tomas Cohen Arazi [Wed, 30 Mar 2022 11:57:39 +0000 (13:57 +0200)]
Bug 30394: Make datatables.js aware of x-koha-request-id

This patch makes the wrapper handle the data.draw parameter (from
DataTables) translating it into the x-koha-request-id header for making
the Koha request, and then translates the received header into data.draw
for proper use in DataTables.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 30394: Add x-koha-request-id support on API routes
Tomas Cohen Arazi [Wed, 30 Mar 2022 11:54:24 +0000 (13:54 +0200)]
Bug 30394: Add x-koha-request-id support on API routes

This patch adds the x-koha-request-id to all GET routes that rely on
objects.search, for immediate support for the header.

The patch itself is trivial:
- It adds the header parameter definition to the top level swagger.yaml
- It adds a reference on each route that already implements q params,
  etc

To test:
1. Apply the patch
2. Reload plack
3. Notice the API still works
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> SUCCESS: It now passes! The /cities route implements the
x-koha-request-id header pass through.
5. Run the rest of the API tests
=> SUCCESS: All good
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30394: Add x-koha-request-id handling in controllers
Tomas Cohen Arazi [Wed, 30 Mar 2022 11:45:48 +0000 (13:45 +0200)]
Bug 30394: Add x-koha-request-id handling in controllers

This patch adds 'x-koha-request-id' to the reserved param names list,
and makes the objects.search helper read it and send it back in the
response headers.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 30394: Unit tests
Tomas Cohen Arazi [Wed, 30 Mar 2022 11:43:50 +0000 (13:43 +0200)]
Bug 30394: Unit tests

This patch adds tests for checking the x-koha-request-id header is
returned on GET routes that have it enabled, and then the request
includes it.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/query.t
=> FAIL: The feature is not implemented, tests fail

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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 28610: Elasticsearch 7 - hits.total is now an object
Kevin Carnes [Tue, 8 Feb 2022 13:48:19 +0000 (14:48 +0100)]
Bug 28610: Elasticsearch 7 - hits.total is now an object

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

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

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

Trivial fix.

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

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

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

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

Signed-off-by: hakam <hakam@inlibro.com>
Signed-off-by: Florian Bontemps <florian.bontemps@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 13952: (follow-up) JS translatability, clean warns, other
Aleisha Amohia [Mon, 14 Feb 2022 12:51:04 +0000 (01:51 +1300)]
Bug 13952: (follow-up) JS translatability, clean warns, other

Also addresses QA test tools, perldoc in ImportExportFramework.pm

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 13952: (follow-up) fixing indentation and rebasing
Aleisha Amohia [Fri, 4 Dec 2020 01:43:14 +0000 (14:43 +1300)]
Bug 13952: (follow-up) fixing indentation and rebasing

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 13952: (follow-up) Removing XML options
Aleisha Amohia [Tue, 21 Apr 2020 07:22:28 +0000 (07:22 +0000)]
Bug 13952: (follow-up) Removing XML options

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 13952: (follow-up) Tests
Aleisha Amohia [Thu, 14 Feb 2019 03:18:43 +0000 (03:18 +0000)]
Bug 13952: (follow-up) Tests

Run:
prove -v t/db_dependent/ImportExportFramework.t and confirm all tests
pass.

I've also added a fix to remove the warns when exporting in ODS format.

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 13952: (follow-up) template filters, moving js to separate file
Aleisha Amohia [Wed, 5 Dec 2018 21:33:48 +0000 (21:33 +0000)]
Bug 13952: (follow-up) template filters, moving js to separate file

This patch adds filters to the template file and moves the JS into a
separate file.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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 13952: (follow-up) Fixing export on default biblio framework
Aleisha Amohia [Tue, 24 Oct 2017 20:46:13 +0000 (20:46 +0000)]
Bug 13952: (follow-up) Fixing export on default biblio framework

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 13952: (follow-up) Fixing import for default auth type
Aleisha Amohia [Thu, 19 Oct 2017 23:57:13 +0000 (23:57 +0000)]
Bug 13952: (follow-up) Fixing import for default auth type

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 13952: (follow-up) Fixing authority type import
Aleisha Amohia [Mon, 19 Jun 2017 01:00:19 +0000 (01:00 +0000)]
Bug 13952: (follow-up) Fixing authority type import

This patch fixes the comments from Comment 29 and the import
functionality. You should now be able to import an exported file without
editing the file at all and the authority type code will be overwritten
in the file (same behaviour as biblio frameworks).

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