Commit graph

559 commits

Author SHA1 Message Date
3fc1f27524
Bug 33971: Remove x-koha-query header support
This patch removes support for the `x-koha-query` header entirely from
the codebase. For the purpose:

- $c->objects->search is adjusted
- Relevant tests are cleared/adapted
- The OpenAPI spec gets the header removed

To test:
1. Apply this patch and run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t \
           t/Koha/REST/Plugin/Query.t \
           t/db_dependent/api/v1/*.t
=> SUCCESS: Tests pass!
2. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-07-03 10:35:06 -03:00
6db025bd9d
Bug 23336: Add checkout API's
This patch adds API's to allow for a checkout flow using the RESTful
API.

We add an availability endpoint to check an items current availability
status. The endpoint can be found at `/checkouts/availability` and is
a GET request that requires item_id and patron_id passed as parameters.

We return an availability object that includes blockers, confirms,
warnings and a confirmation token to be used for checkout.

We also add a corresponding checkout method to the `/checkouts` endpoint.
The method accepts a POST request with checkout details including item_id
, patron_id and the confirmation token in the body.

Future work: We should properly migrate CanBookBeIssued into Koha::* and
use that here instead of refering to C4::Circulation.

Signed-off-by: Silvia Meakins <smeakins@eso.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-07-03 10:34:59 -03:00
a8633a5812
Bug 34130: Make requested_date nullable in api definition
This patch allows the requested_date for an ILL request to be NULL to accomodate
older data

To test:
1 - Install the Koha 2 Koha ILL plugin:
    https://gitlab.com/koha-community/plugins/koha-plugin-ill-koha
2 - Enable the ILL  system preference
3 - Force an ILL request with minimal data from backend:
    INSERT INTO illrequests (borrowernumber,biblio_id,branchcode,backend,status) VALUES (5,3,'CPL','Koha','placed');
4 - View the ILL table
5 - Error:
    {"message":"Expected string - got null.","path":"\/body\/0\/requested_date"}
6 - Apply patch
7 - Table loads successfully

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-06-29 11:11:11 -03:00
1f0cd38d56
Bug 33993: Add order_receive to GET orders endpoints
This adds order_receive to the list of permissions that allow the
endpoint to return orders.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Sharon Dugdale <Sharon.Dugdale@cumberland.gov.uk>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-06-23 09:46:39 -03:00
78f1bfaccf
Bug 33859: Use the phrase 'Identity providers' instead of 'Authentication providers'
This patch updates instances in the code and templates where the term
"Authentication providers" is used, replacing it with the preferred
"Identity provider."

Most of the instances of this change are in module or API documentation,
but you can see a couple of the changes in the interface:

- Administration -> Identity providers:
  - The sidebar menu should show "Identity providers" instead of
    "Authentication providers."
- Patrons -> Patron details -> More -> Set permissions
  - Under " Manage Koha system settings (Administration panel)" you
    should see "Manage identity providers (manage_identity_providers)"

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-06-05 14:36:03 -03:00
aae996e6bf
Bug 33708: Provide non-public endpoint for OAuth/OIDC for staff interface
This change fixes the definition for the non-public endpoint for the OAuth/OIDC
implementation.

It also uses the non-public endpoint for the staff interface UI.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-18 11:35:15 -03:00
b1db26ddd3
Bug 8179: Remove leftover/not used embed definitions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-15 08:53:49 -03:00
Agustin Moyano
a551cb47ea
Bug 8179: Receive multiple orders
This patch implements the code to allow a patron to receive multiple
orders at the same time in /cgi-bin/koha/acqui/orderreceive.pl page

To test:
1. apply all patches
2. updatedatabase
3. Go to system preferences and allow AcqReceiveMultipleOrderLines
4. In acquisitions module, create a vendor if you don't have one and add
   3 baskets.. one with create items on ordering, one with create items
   on receiving and finally one with create items when cataloguing
5. Fill baskets with orders (There should be at least 15 orders in total). There should be a mix of orders created by suggestions, others by subscriptions and others by neither of those methods.
6. Close all baskets and receive shipment.
CHECK => in /cgi-bin/koha/acqui/parcel.pl page, in top table there is a column with checkboxes, and a button that says "Receive selected"
7. If all orders from all baskets are shown in the table, set the rows per page to 10, so table has more than one page
8. Check some of the checkboxes
CHECK => "Receive selected" button shows how many rows are selected
9. Go to the next page and select some more rows
CHECK => Changing page does not modify how many rows where selected
10. Go back to previous page
CHECK => Previously selected rows are still selected
11. Reload the page to deselect all rows
12. Select only one row and click on "Receive selected" button
CHECK => the page /cgi-bin/koha/acqui/orderreceive.pl behaves just the same as if the "receive" link in the selected row would have been clicked.
13. Click on cancel to go back to parcel.pl page
14. Select all rows (even the ones from the next page of the table) and
    click on "Receive selected"
CHECH => In orderreceive.pl page there is a table with all selected rows
15. Ensure table has more than one page, as in step 7
16. Click on the "edit" link in the last row of the current page
CHECK => A modal window is displayed with 4 tabs within: Info,
Accounting, Receipt history and Items
CHECK => Modal has 4 buttons at the bottom, 'Previous' to go to previos
order, 'Cancel' to close the modal without keeping modifications, 'Save'
to close modal keeping modifications and 'Next' to go to the next order
CHECK => Even that we are at the end of the current page, 'Next' button
is still available
17. Click on 'Next' button
CHECK => The table behind the modal now displays the next page, and the modal was not closed
18. Click on 'Previous'
CHECK => The table behind the modal went back to the first page, and the modal was not closed
19. Click on 'Previous' button till you reach the first row of the first
    page
CHECK => Only when you reach the first row of the first page 'Previous'
button gets disabled
20. Click on 'Next' button till you reach the last row of the last page
CHECK => Only when you reach the last button of the last page 'Next'
button gets disabled
21. Check that behaviour for the different types of order are still the
    same
    a. For orders that where created through suggestion, check that the
suggestion info is present in Info tab. If when suggestion was accepted
you set a reason, a dropdown to change the reason shoul display also.
    b. For orders that where created through subscriptions, check that
the Items tab is disabled, and the Receipt history is enabled. On
accounting tab you should be able to change quantity ordered. If there
were less items received than ordered, the next time you receive this
order the child order generated from this one shoul appear in receipt
history.
    c. For orders that don't come from subscription and creates there items on ordering, Receipt history
should be disabled, and a table with prefilled items shold appear in the
Items tab. You can edit them and the changes should appear in the item's
row.
    d. For orders that don't come from subscription and creates there
items on receiving, Receipt history should be disabled, and a form to
create the items should appear in Items tab. When you add an item a
table should appear.
    e. For orders that don't come from subscription and creates there
ites on cataloguing, Receipt history and Items tabs should be disabled.
    f. Any changes made in quantity (received or ordered) or funds in the modal should be
reflected in the table if you click save from the modal.
22. Once you've done all you checking and verifications click save
23. While saving a progress bar should appear
24. If no error was detected, you should be redirected back to parcel.pl
    page
25. If an error or warning was detected (like there is an order with 0
    items to receive) the save button should be disabled and warnings
are dispayed.
26. prove t/db_dependent/Koha/Acquisition/Fund.t t/db_dependent/Koha/Acquisitoin/Order.t t/db_dependent/Koha/Item.t

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-15 08:53:47 -03:00
3a2ae8e3f9
Bug 31212: Adjust item spec for last_seen_date
This bug changed the column to a date-time and the spec gets adjusted as
well.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-15 08:53:46 -03:00
b7c1f3cf58
Bug 31799: (follow-up) Add 409 error to spec
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-09 10:57:56 -03:00
Agustin Moyano
51d50810fa
Bug 31799: Add REST endpoint to modify a biblio's item
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Get a biblio with an item
4. Make a PUT request to /api/v1/biblios/:biblio_id/items/:item_id with a json body that represents an item to replace
5. Check that the item was modified
6. Sign off

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-09 10:57:55 -03:00
Agustin Moyano
141c7cdf1a
Bug 31798: (follow-up) Tidy up and add duplicate barcode test
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 17:45:17 -03:00
Agustin Moyano
a7c5b80d70
Bug 31798: Add REST endpoint to add a biblio's item
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Get a biblio
4. Make a POST request to /api/v1/biblios/:biblio_id/items with a json body that represents the new item
5. Check that the item is created
6. Sign off

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 17:45:16 -03:00
a702f57adf
Bug 21043: Handle exceptions and switch to debit response
We were cheating a bit here and expecting a 'debit' to be sent in but a
'line' to be returned.

We should really be sending a debit and returning a debit.. so I've
update the paths schema as such and we're now coercing the
Koha::Account::Line object that's returned by Koha::Account->add_debit
into a Koha::Account::Debit object. Longer term it would be nice to
convert returns from the various Koha::Account methods to their correct
Koha::Account:: objects as apposed to them all being the base ::Line

I've also added some code to catch exceptions that can be thrown by
Koha::Account->add_debit and added the appropriate 400 errors into the
path specs again.

Finally.. I added more unit tests to prove the above

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 12:13:52 -03:00
Agustin Moyano
ab10759c50
Bug 21043: Add debit REST endpoint
This patch adds an endpoint to create a debit for a patron.

Testplan

1. Create a new account debit type (Administration > Debit types)
2. Add a fee with this debit type to a patron’s account via API
3. Make sure that this fee is shown in the accounting overview in the patron’s account in the staff interface
4. Make sure that it is possible to make a payment for this fee

Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 12:13:51 -03:00
Agustin Moyano
1ecc49dc7a
Bug 29453: (follow-up) Add tests and fix minimum amount in credit.yaml definition
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 12:13:51 -03:00
f4c6a5dfd5
Bug 29453: Add endpoints for fetching patron credits & debits
This patch adds two new API endpoints for fetching a patrons credits and
a patrons debits.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 12:13:50 -03:00
Agustin Moyano
67cafa719b
Bug 32735: Add endpoint to list authorities
This patch adds an endpoint to list authorities

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 12:13:49 -03:00
Agustin Moyano
b2801da206
Bug 31796: Add REST endpoint to modify an authority
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Pick an authority to modify, and modify it's marc record
4. Make a PUT request to /api/v1/authorities/:authid with one of the following content type header
  - application/json
  - application/marcxml+xml
  - application/marc-in-json
  - application/marc
5. If content type is other than 'application/json' place the following header in the request 'x-authority-type: <auth type>'
5. Check that the authority was modified
6. Sign off

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 12:13:44 -03:00
138c370746
Bug 31795: Fix required permissions
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 10:18:44 -03:00
531d03e811
Bug 31795: (QA follow-up) Use x-koha-override header
Despite its title, this patch does a couple more things.

1. The tests are rewritten to cover more things, and also to avoid
   deleting all authorities inside the transaction. It is really not
   required.
2. It makes the endpoint rely on the already generically implemented
   x-koha-override header, which is intended for the same use case as
   x-confirm-not-duplicate is for.
3. It changes the return codes to match the coding guidelines [1]
4. Only checks for duplicates if no override passed.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/authorities.t
=> SUCCESS: Tests pass!
2. Apply this follow-up
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

[1] https://wiki.koha-community.org/wiki/Coding_Guidelines_-_API#SWAGGER3.2.1_POST

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 10:18:43 -03:00
Agustin Moyano
1cbe4c2e41
Bug 31795: Add REST endpoint to add an authority
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Make a POST request to /api/v1/authorities with one of the following content type header
  - application/json
  - application/marcxml+xml
  - application/marc-in-json
  - application/marc
4. If content type is other than application/json, then add the following header to the request: "x-authority-type: <auth type code>"
5. Check that the authority is created
6. Sign off

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 10:18:43 -03:00
4ab67c196d
Bug 33262: Add new field to REST API route for orders
Without this patch the API driven list of pending orders
on the order receive page was broken.

With the patch, all should be well now.

prove -v t/db_dependent/api/v1/acquisitions_orders.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 10:18:34 -03:00
50909d2266
Bug 22440: Move backend statuses api endpoint
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 09:13:43 -03:00
313ce33b22
Bug 22440: ILL API changes
* Add GET /illbackends/{id}/statuses
* Change API route to ill/requests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 09:13:42 -03:00
33084fb40c
Bug 22440: New ILL requests table
Use kohaTable requesting the REST api instead of the old KohaTable

Co-authored-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 09:13:41 -03:00
e64fd9aafc
Bug 22440: Add GET /ill_requests
Co-authored-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 09:13:41 -03:00
00629fe94f
Bug 33328: Rename x-marc-schema => x-record-schema
This patch renames the header on the biblio API so it is not entirely
tied to MARC, trying to follow the biblio_metadata table generic
approach.

To test:
1. Apply this patch
2. Run:
   $ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass
3. You agree with the change?
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Change sounds reasonable. Tests pass before and after patch.
"grep -r "x-marc-schema" *" confirms no occurrences after patch.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-05 09:13:24 -03:00
14e5e175fc
Bug 33103: Embed aliases in GET /vendors
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-04-20 15:48:38 -03:00
1c03ff77b2
Bug 33066: Use KohaTable for LicensesList
Bug 33066: (follow-up) Use KohaTable for LicensesList

There was a mismatch, we can embed the whole vendor object info.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Agustín Moyano <agustinmoyano@theke.io>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-04-10 07:38:43 -03:00
922ed2d283
Bug 33066: Embed vendor and retrieve vendor name from the request
Bug 33066: (follow-up) Embed vendor and retrieve vendor name from the request

It needs "Bug 32923: Allow to embed user_roles for agreements"

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Agustín Moyano <agustinmoyano@theke.io>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-04-10 07:38:38 -03:00
b0a570796c
Bug 33146: Add public items lookup route
This patch adds a /public equivilent to the item listing endpoint.

This allows us to search for an item by it's external_id (barcode).

Test plan
1. Apply patch
2. Perform a GET on /api/v1/public/items?external_id=some_barcode
3. Confirm that the above endpoint correctly returns items that should
   be visible in the OPAC

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 33146: (QA follow-up) Do not delete all items in test

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 33146: Allow embedding expanded coded values

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 33146: (QA follow-up) Consistency with /biblios/:biblio_id/items

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Bug 33146: (QA follow-up) Make sure public API enabled for tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-31 12:26:57 +02:00
Julian Maurice
6561cd84b6
Bug 33021: Show an alert when adding a reserved item to an item bundle
Test plan:
1. Create an item bundle (see bug 28854 comment 458)
2. Create a biblio with one item and place a hold for this item.
3. Try to add the reserved item to the bundle
   You should see a message saying that the item is reserved. Next to
   this message should be a button "Ignore holds and add to bundle".
4. Click on the button. There should be a message saying that the item
   was added to the bundle.
5. Close the modal window and verify that the item was correctly
   added to the bundle

Signed-off-by: Lucas Gass <lucas@bywatersolutiosn.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-27 12:50:05 +02:00
Julian Maurice
de36244266
Bug 32121: Show an alert when adding a checked out item to an item bundle
When trying to add a checked out item to an item bundle, an alert
message will show up, giving the user a chance to return the item
immediately before adding it to the bundle

Test plan:
1. Create an item bundle (see bug 28854 comment 458)
2. Create a biblio with one item and check out this item.
3. Try to add the checked out item to the bundle
   You should see a message saying that the item is checked out. Next to
   this message should be a button "Check in and add to bundle".
4. Click on the button. There should be a message saying that the item
   was added to the bundle.
5. Close the modal window and verify that the item was correctly
   returned and added to the bundle

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-27 12:50:02 +02:00
479d8719c5 Bug 32923: Allow to embed user_roles for agreements
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2023-03-23 15:04:07 +01:00
0fb86ccdc5
Bug 32923: Fix licenses spec
Bug 32713 is now validating embed and brought this flaw to light.
Before this patch, listing licenses on ERM would result in a 400 bad request

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-20 13:39:40 -03:00
8ba4aabf07
Bug 33227: (follow-up) Improve docs
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-20 09:39:51 -03:00
185b431ebf
Bug 33227: Remove invalid spec and adjust the code accordingly
The spec contains a non-standard definition for the body param. Removing
it from the spec makes us need to handle the 'body' manually in the case
of JSON data.

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

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-20 09:39:50 -03:00
70fcbce07f
Bug 32923: (follow-up) Fix x-koha-embed from EHoldings/*/*
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-17 11:25:34 -03:00
Agustin Moyano
a4fb1ca3d1
Bug 32734: Add REST endpoint to list biblios
This patch adds an endpoint to list biblios

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

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:12:04 -03:00
Agustin Moyano
4438c4da2e
Bug 31801: Add REST endpoint to modify a biblio
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Pick a biblio to modify, and modify it's marc record
4. Make a PUT request to /api/v1/biblios/:biblionumber with one of the following content type header
  - application/marcxml+xml
  - application/marc-in-json
  - application/marc
5. Add the following header in the request 'x-framework-id: <framework id>'
5. Check that the biblio was modified
6. Sign off

Signed-off-by: Hammat Wele <hammat.wele@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:11:19 -03:00
Agustin Moyano
b5d6ccdf60
Bug 31800: Add REST endpoint to add a biblio
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Make a POST request to /api/v1/biblios with one of the following content type header
  - application/marcxml+xml
  - application/marc-in-json
  - application/marc
4. Add the following header to the request: "x-framework-id: <framework id>"
5. Check that the biblio is created
6. Sign off

Signed-off-by: Jan Kissig <jkissig@th-wildau.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-10 11:47:18 -03:00
b70ce9dcad Bug 31793: (QA follow-up) Require editauthorities flag
This patch makes the route require the right permissions. Tests are
adjusted to reflect this new situation.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-10 10:21:19 -03:00
Agustin Moyano
36a86d7478 Bug 31793: Add REST endpoint to delete authorities
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Get the id of an authority
4. Make a DELETE request to /api/v1/authorities/{authid}
5. Check that the authority was deleted
6. Sign off

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-10 10:21:19 -03:00
dab0260702 Bug 33161: Add +strings support to GET /items and /items/:item_id
This patch introduces the `api_strings_mapping` method to the
*Koha::Item* class, and makes the API spec for the following routes:

* GET /items
* GET /items/:item_id
* GET /acquisitions/orders

accept the new `+strings` parameter that can be passed through the
`x-koha-embed` header and was introduced by bug 26635. In the case of
/acquisitions/orders, you will need to use

x-koha-embed: items+strings

I introduce it here to highlight the flebility we introduced with bug
26635.

The `api_strings_mapping` method has its roots on the cool
`columns_to_str` method already present. The main differences:

* It is aware of the `public_read_list` for attributes so no hidden
  information is exposed.
* Attribute names get mapped for consistency with the API (e.g.
  `homebranch` is converted into `home_library_id`, etc).
* The data structure it returns includes information about the source
  for the descriptions (e.g. it it is an authorised value, then `type`
  will be `av`, and the related category information is returned so
  dropdowns and such can be built. The same goes for other types as
 `library`, `item_type` and `call_number_source`.

To test:
1. Apply this patch
2. Reload everything
3. Play with your favourite REST tool (e.g. Postman)
4. Try:
GET http://localhost:8081/api/v1/items
x-koha-embed: +strings
=> SUCCESS: You get a list of items, they include the new _strings
structure, and the contents make sense!
5. Repeat with a specific item:
GET http://localhost:8081/api/v1/items/14
x-koha-embed: +strings
=> SUCCESS: It all makes sense!
6. Sign off :-D

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-10 10:20:09 -03:00
Agustin Moyano
652743e30d
Bug 31794: (follow-up) Add description to authorities tag
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 14:45:27 -03:00
Agustin Moyano
1e72e59030
Bug 31794: Add REST endpoint to get an authority
To test:
1. Apply patch
2. Set RESTBasicAuth preference to true
3. Get the id of an authority
4. Make a GET request to /api/v1/authorities/{authid} with one of the following content type header
  - application/json
  - application/marcxml+xml
  - application/marc-in-json
  - application/marc
  - text/plain
5. Check that you get the authority in the corresponding format
6. Sign off

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 14:45:26 -03:00
9855b480b1 Bug 25655: REST API specs
Sponsored-by: The Research University in the Helmholtz Association (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 13:57:53 -03:00
dcf7688b94 Bug 31028: Add catalog concern management page to staff
This patch adds a catalog concern management page to the staff client
accessible via the cataloging home page and a new 'Pending catalog
concerns' link on the front page.

This includes added the requisit ticket_updates api endpoints and notice
triggers and templates for notifying patrons of changes to their
reported concerns.

Test plan
1) Enable the `OpacCatalogConcerns` system preference
2) Catalog concern management is tied to your users ability to edit the
   catalog, `editcatalogue`.
3) Confirm that you can see 'Catalog concerns' listed on the cataloging
   home page if you have the `editcatalogue` permission and not if you
   do not.
4) Add a new concern as an opac user.
5) Confirm that once a concern is present in the system you see a count
   of 'catalog concerns pending' on the intranet main page if you have
   the `editcatalogue` permission.
6) Click through either the cataloging home page or pending concerns
   link on the main page to view the new concerns management page.
7) Confirm the table displays as one would expect.
8) Confirm clicking on details or the concern title exposes a 'details'
   modal with the option to add an update or resolve the concern.
9) Verify that if selecting 'notify' when updateing or resolving a
   concern triggers a notice to be sent to the opac user who first
   reported the issue.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Helen Oliver <HOliver@tavi-port.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 11:23:17 -03:00
e87ca28883 Bug 31028: Add API's for tickets
This patch adds basic CRUD API's for the ticket endpoints.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Helen Oliver <HOliver@tavi-port.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 11:23:17 -03:00
79f7f44aa1
Bug 33145: Fix ERM swagger specs
This patch adds the missing 'Provider name' parameter definition to the
various ERM paths that were missing it.

Test plan
1) Run:
   docker run --rm -v $PWD/api/v1/swagger:/swagger \
          jeanberu/swagger-cli \
          swagger-cli validate swagger/swagger.yaml
=> FAIL: The spec is not valid!
2) Apply this patch
3) Repeat 1
=> SUCCESS: Tests pass!

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Edit: tcohen edited the test plan because of the failure to install
swagger-cli cleanly
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-06 09:51:43 -03:00
2d31e83f37
Bug 32997: (QA follow-up) values => authorised_values
This patch renames that for consistency, and also makes use of the
->authorised_values accessor on the category.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-02 12:00:17 -03:00
bbc0e8fe32
Bug 32997: Add REST API endpoint to list authorised values for multiple given categories
This patch adds /api/v1/authorised_value_categories endpoint that
retrieves authorised value categories for the given names and their
authorised values if x-koha-embed: authorised_values is also given.

To test:
Apply patch
curl -u koha:koha --request GET \"http://localhost:8081/api/v1/authorised_value_categories?q=%7B%22me.category_name%22%3A%5B%22LOC%22%2C%22YES_NO%22%5D%7D\" --header \"x-koha-embed:authorised_values\"

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-02 12:00:15 -03:00
7e5c75549f
Bug 32981: Add endpoint to get AV for given category
For, at least, the ERM module we would like to retrieve the authorised
values for a given category to build a dropdown list with the different options.

It has been decided on bug 17390 to use
GET /authorised_value_categories/:authorised_value_category_id/values

Test plan:
curl -v -s -u koha:koha --request GET  http://kohadev-intra.mydnsname.org:8081/api/v1/authorised_value_categories/LOC/values
Should display the list of LOC

curl -v -s -u koha:koha --request GET  http://kohadev-intra.mydnsname.org:8081/api/v1/authorised_value_categories/xLOCx/values
Should return a 404

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-02 12:00:10 -03:00
b68a9a3596
Bug 32923: Add 'vendor' for local packages
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-27 11:07:19 -03:00
b7ae86a134
Bug 32923: Some fixes in ERM specs
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-27 11:07:19 -03:00
423ea26327
Bug 32923: Fix new occurrences of x-koha-embed at top level
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-27 11:07:14 -03:00
c90f60adfc
Bug 30642: Make renewal_type an enum in spec and add test
This patch makes the renewal_type an enum, to match the change on the
DB. A test is added to account the fact the API is always setting
'Manual' request type.

Bonus: small portion of code gets a tidy, should've been asked by QA.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-10 11:08:00 -03:00
5045da59f1
Bug 30642: Record renewal type
A requirement has been requested to record whether a renewal was done manually or automatically. A column has been added to the checkout_renewals table in the database to record this and a check is now in place to determine whether the renewal was manual or automatic. The API has also been updated to reflect this new column and return the data when requested. The renewals modal view has also been updated to show what type the renewal was.

Test plan:
1) In the database shell run "show columns from checkout_renewals;" and observe that there is currently no column for recording the type of renewal
2) Apply patch
3) In the shell run "dbic" and "perl installer/data/mysql/updatedatabase.pl" to update the database schema with the new column.
4) Create some checkouts
5) Renew some checkouts manually and observe in the database that there is now a column called "renewal_type" that will have recorded these as "Manual"
6) Create some checkouts that can be automatically renewed
7) Run the cron script in automatic_renewals.pl and observe that there are now also entries with a renewal_type of "Automatic"
8) Send a GET request to http://localhost:8081/api/v1/checkouts/1/renewals and observe that the renewal_type is now returned in the response
9) In the Item Details tab for a record, there is the "Current renewals" option which has a button to view renewals. Click on this and observe that the modal now displays the new information.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-10 11:07:57 -03:00
ba40541038
Bug 30962: (QA follow-up) Rename attribute and simplify tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-03 10:30:13 -03:00
a8a356404c
Bug 30962: REST API: Add endpoint /auth/password/validation
This patch adds an endpoint for /auth/password/validation

This allows a third-party, using an authenticated and authorized Koha
API user, to check if the username and password given by a user is
correct in Koha.

For example, a Keycloak extension can be created using its
User Storage SPI to use Koha as the user database for Keycloak. This
API allows us to authenticate the user as a particular Koha user - without
creating a Koha user session for them.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RESTBasicAuth
2. Enable "RESTBasicAuth"
3. Run the following commands while substituting correct values for <koha_user> and <koha_password>
3. curl -XPOST -H "Content-Type: application/json" -u <koha_user>:<koha_password> http://localhost:8081/api/v1/auth/password/validation -d '{ "username": "<koha_username">, "password": "<koha_password>" }' -v
4. Note "204 No Content" response
5. curl -XPOST -H "Content-Type: application/json" -u <koha_user>:<koha_password> http://localhost:8081/api/v1/auth/password/validation -d '{ "username": "<koha_username">, "password": "this is definitely not the password" }' -v
6. Note "400 Bad Request" response and error message {"error":"Validation failed"}

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-02-03 10:30:11 -03:00
26d1e6540d
Bug 27424: Add ability to specify an SMTP server in the database as the default server
Bug 22343 adds the ability to defined SMTP servers via the UI; But to then utilise them you have to go to each individual library via the libraries admin area and select the SMTP server.

We should have a way to override the fallback/default SMTP server right from the SMTP servers administration page.. setting one of our defined SMTP Servers as the system default rather than using the hard coded fallback options.

Test Plan:
1) Apply this patch set
2) Restart all the things!
3) Browser to the SMTP servers editor,
   verify only one server can be set as the default server
4) Set a default server, verify that server was used to send email from
   a cronjob, AND/OR prove t/db_dependent/Koha/SMTP/Server.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-31 10:52:48 -03:00
ebf7b6471f
Bug 31797: Add DELETE /items/:item_id endpoint
This patch adds the mentioned endpoint. The controller relies on
Koha::Item->safe_to_delete for checks and uses `safe_delete` as
additem.pl does.

The required permissions are edit_catalogue.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/items.t
=> SUCCESS: Tests pass!
3. Play with item deletion using a REST tool like Postman
=> SUCCESS: All works as expected
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-01-30 12:20:44 -03:00
1d522cc246
Bug 31160: Required fields in patron api
The Patron API PUT request required the fields "surname","address","city","library_id","category_id". Meanwhile the CSV import page for patrons only requires "surname","library_id","category_id". The fields for "address" and "city" have been removed from the "required" section of the api>v1>swagger>definitions>patron.yaml file to match the CSV import page.

Test Plan:
1) Send a PUT request to http://localhost:8081/api/v1/patrons/19 with an empty body
2) Error message should ask for 5 missing fields as listed above
3) Apply patch
4) Restart Apache server using "restart_all" in your ktd shell
5) Resubmit your request
6) Error message should now only request "surname","library_id","category_id"

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-13 08:44:35 -03:00
Aleisha Amohia
a4d9f572bc
Bug 32354: Accept session_state param given by OAuth IdP
This patch ensures Koha doesn't throw an error if the IdP hands back a
session_state parameter.

To test:

1) Set up an identity provider
2) On the IdP's configuration, make it hand back a session_state
3) Confirm authentication using OIDC works with and without the
session_state

Sponsored-by: Plant & Food Research

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-12-07 12:58:32 -03:00
f690513947
Bug 31381: Handle null attributes in list
This patch allows null values to be returned in patron attributes
to prevent a crash when searching patrons

To test:
1 - Add a NULL attribute to a borrower, in sample data, Edna Acosta
    sudo koha-mysql kohadev
    INSERT INTO borrower_attributes (borrowernumber,code,attribute) VALUES (5,'SHOW_BCODE',NULL);
2 - Browse to 'Home->Patrons'
    http://localhost:8081/cgi-bin/koha/members/members-home.pl
3 - Click 'Browse by last name: A'
4 - Datatables error:
    Expected string - got null
5 - Apply patch
6 - Restart all
7 - Browse by last name: A
8 - Success!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-30 15:58:13 -03:00
22e78b5ffa
Bug 32154: Missing primary key on erm_user_roles table
The aforementioned TestBuilder should display "Koha::ERM::UserRole", not be empty.

This patch adds a primary key to the erm_user_roles table and fixes that.

Also includes atomicupdate file to update database schema as well as updates to
kohastructure.sql provided by Jonathan Druart.

Looked into the vue files but didn't find anywhere or a need to include the new
primary key in any of the requests as there is no request of users by role_user_id
being made.

Erm users are being created/updated as a relationship through licenceses/agreements.

Furthermore, when editing a role of an existing user, this new primary key is already
being supplied embeded in the license/agreement.

Test plan:
Add users to license and agreement
Run the cypress tests
Confirm that the change fix the test that was failing in TestBuilder.t
(another one may still fail however)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-11 08:54:34 -03:00
18319c1654
Bug 32030: Add missing additionalProperties to /erm/eholdings/local/titles/import
This fixes xt/api.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-09 09:48:34 -03:00
Agustin Moyano
016105cf8c
Bug 31378: Rename Auth Provider to Identity Provider and add Client.t tests
Signed-off-by: Lukasz Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 14:39:51 -03:00
f97ba16e44
Bug 31378: Add authentication provider endpoints
This patch adds routes for handling authentication providers to the REST
API.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lukasz Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 14:31:20 -03:00
Agustin Moyano
5c8ab4f590
Bug 31378: Add API routes
Signed-off-by: Lukasz Koszyk <lukasz.koszyk@kit.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 14:30:37 -03:00
Pedro Amorim
0e36cbb9fb
Bug 32030: Add users to licenses - REST API Spec
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:49 -03:00
Pedro Amorim
7423641322
Bug 32030: Max document file size - REST API spec
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:45 -03:00
Pedro Amorim
48cf2a24a2
Bug 32030: ERM EHoldings Resources - Remove inexistent 'resources' embed from resources
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:40 -03:00
Pedro Amorim
91b1f92105
Bug 32030: ERM Licenses - Make field 'type' not nullable, it isn't nullable in the DB schema or the vuejs frontend form.
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:39 -03:00
Pedro Amorim
95d81d3704
Bug 32030: Remove inexistent 'agreements' embed from licenses - API spec
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:34 -03:00
Pedro Amorim
5234bc22f4
Bug 32030: Add document to license - REST API spec
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:31 -03:00
Pedro Amorim
19fc1bdef5
Bug 32030: Add Notes field to erm_eholdings_packages table
- Added API specs for new field 'notes' for erm_holdings_package;
- Added new field 'notes' in DB schema for erm;
- Added new field 'notes' in Vue.js frontend

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:26 -03:00
6f32bf07dd
Bug 32030: Show on the title list view if titles are selected in KB
Same as packages, but for titles here.

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:24 -03:00
65cffa9619
Bug 32030: Add/remove packages to/from EBSCO's holdings
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:23 -03:00
98ab918470
Bug 32030: Add/remove resources to/from EBSCO's holdings
Add an "Add to holdings" and "Remove from holdings" buttons on the
resource page.

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:23 -03:00
b9096fe7df
Bug 32030: Filter by expired agreements
This patch adds a checkbox and flatpickr input to filter agreements by
expiration date.

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:21 -03:00
94c67c439e
Bug 32030: Create eHolding titles from a list
Add the ability to create new titles and attach them to a package.
The MARC to KBART2 mapping is the following (based on
https://github.com/adambuttrick/marc_to_kbart/blob/master/convert.py):

publication_title = biblio.title
print_identifier  = 020$a||020$z||022$a||022$y
online_identifier = 020$a||020$z||022$a||022$y
date_first_issue_online = 866$a (before '-')
date_last_issue_online  = 866$a (after '-')
num_first_vol_online    = 863$a (before '-')
num_last_vol_online     = 863$a (after '-')
num_first_issue_online  = ?
num_last_issue_online   = ?
title_url = 856$u
first_author = biblio.first_author
embargo_info = ?
coverage_depth = title_url ? 'fulltext' : 'print'
notes = $852$z
publisher_name = 260$b
publication_type = ?
date_monograph_published_print = ?
date_monograph_published_online = ?
monograph_volume = ?
monograph_edition = ?
first_editor = ?
parent_publication_title_id = ?
preceeding_publication_title_id = ?
access_type = ?

Note that title is not created (and so the resource) if a title from
this package already has a link to this bibliographic record.
Is that correct, or should we create another resource?

Should the import screen also have "start date" and "end date" to set for the
resource?

QA note: Ideally we would like to fetch the list from the REST API but the routes
are not there yet.

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:20 -03:00
fccf6acc04
Bug 32030: ERM - Add vendor to license
ALTER TABLE erm_agreement_licenses DROP FOREIGN KEY erm_licenses_ibfk_1;
ALTER TABLE erm_agreement_licenses DROP FOREIGN KEY erm_licenses_ibfk_2;
ALTER TABLE erm_agreement_licenses ADD CONSTRAINT `erm_agreement_licenses_ibfk_1` FOREIGN KEY (`agreement_id`) REFERENCES `erm_agreements` (`agreement_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE erm_agreement_licenses ADD CONSTRAINT `erm_agreement_licenses_ibfk_2` FOREIGN KEY (`license_id`) REFERENCES `erm_licenses` (`license_id`) ON DELETE CASCADE ON UPDATE CASCADE;

ALTER TABLE erm_licenses ADD COLUMN vendor_id INT(11) DEFAULT NULL AFTER license_id;
ALTER TABLE erm_licenses ADD CONSTRAINT `erm_licenses_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:19 -03:00
64a838ce32
Bug 32030: ERM - Agreement documents (FIXED)
Document - don't send file_content when fetching a document

apt install libmojolicious-plugin-renderfile-perl

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:18 -03:00
3fdc503ca7
Bug 32030: Display the list of packages on the 'show agreement' view
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:13 -03:00
111622efcc
Bug 32030: Link external packages with agreements
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:11 -03:00
46744e1e9b
Bug 32030: Make the ERMProviders syspref multivaluated
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:09 -03:00
769a1b3477
Bug 32030: Proxy with HoldingsIQ
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:07 -03:00
bd8c251459
Bug 32030: Create a local bibliographic record for resources
When a new resource is created we create a new bibliographic record in
Koha that is linked at the title level

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:07 -03:00
35ba0baa9c
Bug 32030: Add links to vendors
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:06 -03:00
15761027f5
Bug 32030: Add title.external_id
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:05 -03:00
70f5e7913c
Bug 32030: Add a route to display a resource
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:02 -03:00
34c9548d5d
Bug 32030: Rename Package|Resource|Title
At this point we renamed eHoldings to Titles and eHoldings-package to
Resource.

Packages, resources and titles are now under the eholdings namespace.

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:02 -03:00
7040d7aadd
Bug 32030: Add eholdings.vendor_id
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:00 -03:00
bdee83ef93
Bug 32030: Link eHolding with packages
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:44:00 -03:00
df6ee0f3e6
Bug 32030: eHolding - API specs
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:59 -03:00
8df00b3634
Bug 32030: Link agreements to a package
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:58 -03:00
aead1dd598
Bug 32030: ERM - Packages - Vue
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:57 -03:00
1ebe382895
Bug 32030: rest api for vendor.external_id
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:57 -03:00
35dc258970
Bug 32030: ERM - packages - REST API specs
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:56 -03:00
c03c616bc2
Bug 32030: ERM - Agreement documents - REST API
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:53 -03:00
0827e10c39
Bug 32030: ERM - related agreement - REST API
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:51 -03:00
ff2bf0d5a3
Bug 32030: ERM - link licenses to an agreement
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:45 -03:00
ab5d7b5a63
Bug 32030: ERM - Licenses
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:44 -03:00
d8ff532551
Bug 32030: ERM - FIX swagger specs for bug 30194
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:40 -03:00
3bf57d92a1
Bug 32030: ERM - REST API - GET POST PUT DELETE specs
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:37 -03:00
b8e7788167
Bug 32030: ERM - Users
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:36 -03:00
8f82195af2
Bug 32030: ERM - GET /erm/agreements spec files
Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-08 09:43:32 -03:00
Katrin Fischer
0c21559fcc
Bug 24860: (QA follow-up) Terminology and translation fixes
* Fixes a single to a double underscore for translation in holds.js
* Fixes item_group to item group in API description
* Fixes volume hold to item group hold in syspref db descrpitions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:39:58 -03:00
9670e71b00
Bug 24860: Implement reserves.item_group_id
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:39:55 -03:00
Aleisha Amohia
974359ed85
Bug 23012: Show the PROCESSING_FOUND account credit type
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-24 17:43:28 -03:00
b93e15c235
Bug 30588: Add the option to require 2FA setup on first staff login
Bug 28786 added the ability to turn on a two-factor authentication,
using a One Time Password (OTP).
Once enabled on the system, librarian had the choice to enable or
disable it for themselves.
For security reason an administrator could decide to force the
librarians to use this second authentication step.

This patch adds a third option to the existing syspref, 'Enforced', for
that purpose.

QA notes: the code we had in the members/two_factor_auth.pl controller
has been moved to REST API controller methods (with their tests and
swagger specs), for reusability reason. Code from template has been
moved to an include file for the same reason.

Test plan:
A. Regression tests
As we modified the code we need first to confirm the existing features
are still working as expected.
1. Turn off TwoFactorAuthentication (disabled) and confirm that you are not able to
enable and access the second authentication step
2. Turn it on (enabled) and confirm that you are able to enable it in your account
3. Logout and confirm then that you are able to login into Koha

B. The new option
1. Set the pref to "enforced"
2. You are not logged out, logged in users stay logged in
3. Pick a user that does not have 2FA setup, login
4. Notice the new screen (UI is a bit ugly, suggestions welcomed)
5. Try to access Koha without enabling 2FA, you shouldn't be able to
access any pages
6. Setup 2FA and confirm that you are redirected to the login screen
7. Login, send the correct pin code
=> You are fully logged in!

Note that at 6 we could redirect to the mainpage, without the need to
login again, but I think it's preferable to reduce the change to
C4::Auth. If it's considered mandatory by QA I could have a look on
another bug report.

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:36:57 -03:00
00f0780b7f
Bug 17170: (QA follow-up) Spec cleanup
This patch removes not required (for now) query parameters as we can
query using q= on those. They can be added back eventually, if needed.

Attributes now match the database as well.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:15:22 -03:00
ce30b50406
Bug 17170: (QA follow-up) Remove re-introduced file
We reintroduced the definitions api spec file with this patch.. it's not
required.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:15:19 -03:00
adf252d96c
Bug 17170: Add API route for SearchFilters
This adds the API routes and tests

Sponsored-by: Sponsored by: Round Rock Public Library [https://www.roundrocktexas.gov/departments/library/]

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-21 11:15:14 -03:00
Johanna Raisa
86a744cbfd
Bug 31555: change holds GET permission to place_holds
This patch changes holds' GET REST API endpoint permission
to place_holds to match with request.pl

Test plan:
1) prove t/db_dependent/api/v1/holds.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-11 10:49:18 -03:00
ed7de793c5
Bug 10950: API spec update
Test plan:
1. Apply patch, restart_all, and updatedatabase
2. In the staff client go to a patron record or create a new patron.
3. Notice the pronouns field, make sure you add a value to it.
4. Now notice that the value should display in parentheses in places where the patron name is displayed.
5. Go to the details page and you should see the value display in quotes. ( next to othernames )

6. Check to make sure you can hide the pronouns field via BorrowerUnwantedField.
7. Check to make sure you can make the field required with BorrowerMandatoryField

8. Go to the OPAC to self register. The pronouns field should appear in the form.
9. Make sure you can make it required ( PatronSelfRegistrationBorrowerMandatoryField ) and that you can hide it ( PatronSelfRegistrationBorrowerUnwantedField ).
10. Once registered check 'your personal details'. Check that the field can be required (PatronSelfModificationMandatoryField) or hidden ( PatronSelfModificationBorrowerUnwantedField ).

11. Try some notices like ISSUESLIP. You should be able to add either <<borrowers.pronouns>> or [% borrower.pronoun %] to the notice and have it display when you generate the notice.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-10-03 15:01:33 -03:00
b9cab0967e
Bug 30982: (QA follow-up) Spelling
[1] Correct: BackgrounJob
[2] If should filter out not current jobs
=> Had a hard time reading that one until I replaced if by it.
=> Decided to rephrase it in a more positive way.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:50 -03:00
88cc881521
Bug 30982: API tweaks
This patch makes the following changes to the 'background_jobs' API:

* We now call them 'jobs'
* Removed deprecated query parameter definitions
* Added only_current query parameter
* Controller gets adapted to use $rs->filter_by_current when
  only_current is passed

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:49 -03:00
1d0f096eaf
Bug 30982: Add 'context' to the REST API specs
context has been added by bug 30889

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:48 -03:00
b9b3b93d93
Bug 30982: Add tests and implement GET /background_jobs/$id
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:48 -03:00
b702e9b08d
Bug 30982: REST API specs
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-23 08:57:40 -03:00
277e19bd10
Bug 15348: Add estimated_delivery_date to object spec
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-16 17:10:41 -03:00
c3b9e5e841
Bug 29144: Copy and remove branches.opac_info (dbrev)
Test plan:
Run dbrev.
Check api URL: /api/v1/public/libraries (with/without suffix /[branch_code].

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-16 09:55:20 -03:00
264a6e5979
Bug 31374: (follow-up) change private note to staff_note and reorder columns
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:32:51 -07:00
168da4e49a
Bug 31374: Update API spec
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-09-07 13:32:43 -07:00
7e991d0702
Bug 29939: Use the REST API for ratings
This patch replaces opac-ratings-ajax.pl with a new REST API route
POST /public/biblios/42/ratings

Note that we could go further and refactor the 'start_rating' select
code.

Test plan:
Test the "star ratings" feature at the OPAC, on the different page
where it's displayed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-22 11:31:15 -03:00
20dbec38f0
Bug 31017: (follow-up) Add type field to api
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-19 16:15:25 -03:00
1f098a8c86
Bug 24857: No words
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 14:00:40 -03:00
fc78953951
Bug 24857: (QA follow-up) Add spec description
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:56:05 -03:00
bb8d86f3bc
Bug 28787: (QA follow-up) Add spec description
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:53:06 -03:00
25c522fea1
Bug 28787: Rename the REST API route to /auth/otp/token_delivery
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:38:44 -03:00
c0864cfdea
Bug 28787: (follow-up) Changes in API auth, moved otp out of Letters
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:38:43 -03:00
6e099d0bbd
Bug 28787: Send a notice with the TOTP token
Bug 28786 let librarians enable a Two-factor authentication but force them to use
an application to generate the TOTP token.

This new enhancement add the ability to send an email containing the token to the
patron once it's authenticaed

The new notice template has the code '2FA_OTP_TOKEN'

Test plan:
- Setup the two-factor authentication (you need the config entry and the
syspref ON)
- Enable it for your logged in patron
- Logout
- Login and notice the new link "Send the code by email"
- Click on it and confirm that you received an email with the code
- Use the code to be fully logged in

QA question: Is 400 the correct error code to tell the email has not
been sent?

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

Sponsored-by: Rijksmuseum, Netherlands

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-08-09 13:38:43 -03:00
b3c9e95fac
Bug 31128: Add effective_not_for_loan_status into items response
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-22 11:32:26 -03:00
dc75b5d5cd
Bug 29105: Add effective_itemtype handling to items api
This patch adds effective_item_type_id to the items api.

We overload the to_api method to append the effective_item_type_id field
with that of the effective itemtype code.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 14:41:25 -03:00
9309dedb53
Bug 30578: Remove circ/ysearch.pl in favor of the /patrons REST API route
This patch removes the circ/ysearch.pl script used by the jQuery autocomplete widget.
We can now use the /api/v1/patrons endpoint to retrieve the patrons and
generate the patron result list.

Prior to this patch the different occurrences were defining the style
and the list of patron's attributes to display for each option (name,
date of birth, age, address, etc.). Now they are all displaying the same
information.

To acchieve this we had to:
* Make js-date-format.inc and js-patron-get-age.inc available from js_includes.inc
and so available from everywhere, which is certainly a good move. We
could discuss why this code is in include file instead of JS files
however.
* Remove the .ajaxSetup call in tags-review.js to reduce its scope: an
underscore parameter was added to the REST API query (?)

A better solution would have been to extend the existing widget
(https://learn.jquery.com/jquery-ui/widget-factory/extending-widgets/)
but I didn't manage to do it, and I feel like there is a bug in jQuery
autocomplete. The "source" was not taken into account.
We could think about replacing the jQuery autocomplete with something
else, but that's outside the scope of this bug.

Test plan:
Search for patrons and confirm the autocomplete works and that the
"select" action works as before (either a redirect or select the
patrons) on the different views:
* Place a hold
* Search for tags (form on the left)
* In the header, "Check out" and "Search patrons"
* Add instructors to course reserves
* View logs (the "librarian" input)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-18 11:01:34 -03:00
c66032ba2c
Bug 28854: Improve lost details display for bundle items
This patch adds the return claim details to the bundle item status
display on the catalogue details page.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:35:36 -03:00
5f614c05fd
Bug 28854: Expose functionality to attach items to bundles
This patch adds methods the the Koha::Item object for managing item
bundling operations and then exposes those methods via the REST API.

We include the new `BundleNotLoanValue` preference for setting not
for loan values when an item is added to a bundle.

Finally, we expose bundle management via the catalogue details page.

Test plan:
0) Apply patches up to this point and run the database update
1) Configuration: `BundleNotLoanValue` should have been set by the
   database update and point to a newly added AV value.
2) Creating a new bundle
   * Add a new bib record
   * Mark the bib record as a 'collection' type by setting leader
     position 7 to 'c'
   * Add a new item to this bib record
   * You should see a new 'Manage bundle' button available in the
     'Actions' column of the Holdings table.
   * Clicking 'Manage bundle' should expand the table to include a new
     row directly beneath this one.
   * Use the new 'Add to bundle' button that appears in this row to
     trigger a modal that allows entering the barcode of items you wish
     to add to the bundle
   * Upon closing the modal, the bundle content table should reload and
     contain your newly associated items.
   * You can subsequently remove an item from a bundle using the new
     'Remove' button.
3) Not for loan
   * Items that have been added into a bundle should now appear as 'Not
     for loan' from their original biblio record and note which bundle
     they belong to.
4) Error cases
   * Try adding an item that already belongs to a bundle to another
     bundle: Note an error is displayed in the modal form.
5) The bundles feature can be disabled by unsetting the
   `BundleNotLoanValue` system preference.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-13 10:35:25 -03:00
86197c407d
Bug 24857: Fix missing additionalProperties in spec
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-08 19:11:23 -03:00
95a6ee4d53
Bug 24857: API spec
To test:
1 - prove t/db_dependent/api/v1/item_groups.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-08 15:59:55 -03:00
4e75a3a1ee
Bug 30903: Fix POST /quote
quote_id should not be required

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-06 16:42:05 -03:00
557dfa9eae
Bug 30275: (follow-up) Rebase fixes
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-05 09:46:12 -03:00
14a8e322e6
Bug 30275: Add alias to create renewal in api routes
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-05 09:46:06 -03:00
5fab94ffa0
Bug 30275: Add /api/v1/checkouts/{checkout_id}/renewals
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-05 09:46:04 -03:00
2d64b3ce8a
Bug 30275: Rename issues.renewals to issues.renewals_count
Rename the issues.renewals field to renewals_count to prevent a method
name collision with the new relation accessor introduced by this
patchset.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-05 09:45:55 -03:00
8993c39b7a
Bug 21978: Add middle_name to api specification
This patch adds middle_name to the accaeptable fields in API requests
and responses.

Test plan
1) Search for a user using the API
2) Confirm the API responds with a 200

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-24 12:24:10 -03:00
Johanna Raisa
71a95d3557
Bug 30780: Librarians with only "place_holds" permissions can not update holds data via REST API
This patch enables librarians with only "place_holds" permissions to cancel, suspend and resume holds via REST API.

Test plan:
1) Try to cancel or suspend a hold with only "place_holds" permissions
2) See that it is forbidden.
3) Apply the patch
4) Cancel a hold again
5) The cancellation succeeds
6) prove t/db_dependent/api/v1/holds.t

Sponsored-by: Koha-Suomi Oy

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-13 11:48:10 -03:00
891972d0d3
Bug 30855: Rename /import => /import_batches
This patch renames the route to make it consistent for future additions.

To test:
1. Run
   $ git grep 'matches/chosen'
=> FAIL: all occurences use /api/v1/import/
2. Apply this patch
3. Run:
   $ git grep 'matches/chosen'
=> SUCCESS: All occurences have '/api/v1/import_batches/'
4. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/import_record_matches.t
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-02 13:42:28 -03:00