Bug 31791 - Add the ability to lock records to prevent modification through the Koha staff interface
Summary: Add the ability to lock records to prevent modification through the Koha staf...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low new feature (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 20256 34943 35919
Blocks: 36372
  Show dependency treegraph
 
Reported: 2022-10-14 12:20 UTC by Nick Clemens
Modified: 2024-04-26 20:20 UTC (History)
9 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00


Attachments
Bug 35919: Add Koha::Biblio::Metadata->source_allows_editing (2.73 KB, patch)
2024-03-18 20:30 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: DB changes (2.39 KB, patch)
2024-03-18 20:30 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add TT plugin method Biblio.CanBeEdited (2.99 KB, patch)
2024-03-18 20:30 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add record locking based on source (2.03 KB, patch)
2024-03-18 20:30 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add edit_locked_records and set_record_sources subpermissions (1.45 KB, patch)
2024-03-18 20:30 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Limit editing locked records (2.71 KB, patch)
2024-03-18 20:30 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) (9.00 KB, patch)
2024-03-18 20:30 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add x-record-source-id header to POST /biblios (5.49 KB, patch)
2024-03-18 20:31 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio->can_be_edited (3.78 KB, patch)
2024-03-19 11:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: DB changes (2.39 KB, patch)
2024-03-19 11:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add TT plugin method Biblio.CanBeEdited (2.99 KB, patch)
2024-03-19 11:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add record locking based on source (2.03 KB, patch)
2024-03-19 11:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add edit_locked_records and set_record_sources subpermissions (1.45 KB, patch)
2024-03-19 11:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Limit editing locked records (2.71 KB, patch)
2024-03-19 11:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) (9.00 KB, patch)
2024-03-19 11:39 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add x-record-source-id header to POST /biblios (5.49 KB, patch)
2024-03-19 11:40 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio->can_be_edited (3.85 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: DB changes (2.45 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Add TT plugin method Biblio.CanBeEdited (3.05 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Add record locking based on source (2.10 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Add edit_locked_records and set_record_sources subpermissions (1.52 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Limit editing locked records (2.78 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) (9.06 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Add x-record-source-id header to POST /biblios (5.55 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Remove CanBeEdited template helper (4.37 KB, patch)
2024-03-19 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio->can_be_edited (3.85 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: DB changes (2.45 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add record locking based on source (2.09 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add edit_locked_records and set_record_sources subpermissions (1.52 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Limit editing locked records (2.78 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) (9.06 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add x-record-source-id header to POST /biblios (5.55 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio::Metadata->record_source (2.90 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Display record source on the detail view (1.58 KB, patch)
2024-03-20 14:28 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: (follow-up) Tidy AddBiblio (11.26 KB, patch)
2024-03-20 14:36 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) (9.03 KB, patch)
2024-04-01 14:46 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add x-record-source-id header to POST /biblios (5.55 KB, patch)
2024-04-01 14:47 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio::Metadata->record_source (2.90 KB, patch)
2024-04-01 14:47 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Display record source on the detail view (1.58 KB, patch)
2024-04-01 14:47 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: (follow-up) Tidy AddBiblio (11.26 KB, patch)
2024-04-01 14:47 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio->can_be_edited (3.90 KB, patch)
2024-04-11 13:38 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: DB changes (2.50 KB, patch)
2024-04-11 13:38 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Add record locking based on source (2.14 KB, patch)
2024-04-11 13:38 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Add edit_locked_records and set_record_sources subpermissions (1.57 KB, patch)
2024-04-11 13:38 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Limit editing locked records (2.83 KB, patch)
2024-04-11 13:38 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) (9.08 KB, patch)
2024-04-11 13:38 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Add x-record-source-id header to POST /biblios (5.59 KB, patch)
2024-04-11 13:39 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio::Metadata->record_source (2.95 KB, patch)
2024-04-11 13:39 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Display record source on the detail view (1.63 KB, patch)
2024-04-11 13:39 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: (follow-up) Tidy AddBiblio (11.31 KB, patch)
2024-04-11 13:39 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio->can_be_edited (3.96 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: DB changes (2.56 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: Add record locking based on source (2.20 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: Add edit_locked_records and set_record_sources subpermissions (1.63 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: Limit editing locked records (2.89 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) (9.14 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: Add x-record-source-id header to POST /biblios (5.66 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: Add Koha::Biblio::Metadata->record_source (3.01 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: Display record source on the detail view (1.69 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: (follow-up) Tidy AddBiblio (11.37 KB, patch)
2024-04-18 08:06 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 31791: (follow-up) Fix Permissions.t (1.37 KB, patch)
2024-04-26 20:20 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2022-10-14 12:20:55 UTC
- Add a read-only field
- The read-only field will only be editable by superlibrarian
- Koha can update these internally for related routines
Comment 1 Katrin Fischer 2022-10-14 22:05:46 UTC
Hi Nick, could you share some details about the use cases for this one?
As we usually don't give superlibrarian permissions to users, could this be tied to a new permission maybe?
Comment 2 Nick Clemens 2022-10-18 13:36:05 UTC
(In reply to Katrin Fischer from comment #1)
> Hi Nick, could you share some details about the use cases for this one?
> As we usually don't give superlibrarian permissions to users, could this be
> tied to a new permission maybe?

We also talked about a new permission, that should not be a problem.

The idea here is really the ability to lock records from certain sources - in this case the library will be cataloging in an external system and pushing records in to Koha. They do not wish for these records to be edited within Koha, so want to protect them - with a limited set of users being able to edit them if the need arises.
Comment 3 Katrin Fischer 2022-10-18 14:07:29 UTC
Ah! That makes a lot of sense and could be useful in our use case as well. 

Are you thinking of some kind of automatism to set the locked maybe on import too?
Comment 4 Tomás Cohen Arazi 2022-11-29 18:26:40 UTC
(In reply to Katrin Fischer from comment #3)
> Are you thinking of some kind of automatism to set the locked maybe on
> import too?

On the API front, this will be a flag to be passed, with (probably) some default for each source i.e. there will be an 'Import sources' crud page, to set this things.
Comment 5 David Cook 2023-01-11 00:07:40 UTC
+1

I would like to see this functionality. There's a number of times we import data from other systems into Koha, and the place to correct that data is upstream, so it would flow into Koha.
Comment 6 Kyle M Hall 2023-01-26 12:47:51 UTC
This should probably be based on ( or at least informed by ) bug 20256 which does a fair amount of refactoring.
Comment 7 Tomás Cohen Arazi 2024-03-18 20:30:16 UTC Comment hidden (obsolete)
Comment 8 Tomás Cohen Arazi 2024-03-18 20:30:42 UTC Comment hidden (obsolete)
Comment 9 Tomás Cohen Arazi 2024-03-18 20:30:45 UTC Comment hidden (obsolete)
Comment 10 Tomás Cohen Arazi 2024-03-18 20:30:48 UTC Comment hidden (obsolete)
Comment 11 Tomás Cohen Arazi 2024-03-18 20:30:51 UTC Comment hidden (obsolete)
Comment 12 Tomás Cohen Arazi 2024-03-18 20:30:55 UTC Comment hidden (obsolete)
Comment 13 Tomás Cohen Arazi 2024-03-18 20:30:58 UTC Comment hidden (obsolete)
Comment 14 Tomás Cohen Arazi 2024-03-18 20:31:01 UTC Comment hidden (obsolete)
Comment 15 Tomás Cohen Arazi 2024-03-18 20:45:59 UTC
The submitted patches implement the requested feature, paired with the 'record sources' feature.

Test plan:
1. Have bug 35919 applied
2. Apply this patchset
3. Create 2 'Record sources' in the Administration section

* Record source A having edition disabled
* Record source B having edition enabled

Take notes on the record source ID for each.

4. Create a valid staff member (known user and pass)
5. Have the user set the following permissions:
- catalogue (staff access)
- editcatalogue => all subpermissions bug `edit_locked_records`
6. Login with the user on a private/incognito browser
7. Pick a record and browse to it on the private browser
=> SUCCESS: You can edit it
8. Make the record source for the chosen record be A:
   $ koha-mysql kohadev
   > UPDATE biblio_metadata SET record_source_id=<A's ID> WHERE biblionumber=<chosen record>;
9. Refresh the private window
=> SUCCESS: You are redirected to an error page
10. Search for the chosen record
11. Try to edit it
=> SUCCESS: The 'Edit record' link is greyed and cannot be used
=> SUCCESS: The greyed text has a tooltip explaining what's going on
12. Either change the record source to B, or just edit the record source A to allow editing
13. Refresh the record detail page
=> SUCCESS: The 'Edit record' link is no longer greyed, and the record can be edited
=> SUCCESS: Record edition is limited by source configuration
14. Verify superlibrarians can always edit such records

Note: the only way to set the record source for now is the API, which is extensively tested on the provided tests (t/db_dependent/api/v1/biblios.t
Comment 16 Tomás Cohen Arazi 2024-03-19 11:39:38 UTC
Created attachment 163405 [details] [review]
Bug 31791: Add Koha::Biblio->can_be_edited

Sponsored-by: ByWater Solutions
Comment 17 Tomás Cohen Arazi 2024-03-19 11:39:41 UTC
Created attachment 163408 [details] [review]
Bug 31791: DB changes

Sponsored-by: ByWater Solutions
Comment 18 Tomás Cohen Arazi 2024-03-19 11:39:44 UTC
Created attachment 163410 [details] [review]
Bug 31791: Add TT plugin method Biblio.CanBeEdited

Sponsored-by: ByWater Solutions
Comment 19 Tomás Cohen Arazi 2024-03-19 11:39:47 UTC
Created attachment 163411 [details] [review]
Bug 31791: Add record locking based on source

Sponsored-by: ByWater Solutions
Comment 20 Tomás Cohen Arazi 2024-03-19 11:39:50 UTC
Created attachment 163413 [details] [review]
Bug 31791: Add edit_locked_records and set_record_sources subpermissions

Sponsored-by: ByWater Solutions
Comment 21 Tomás Cohen Arazi 2024-03-19 11:39:53 UTC
Created attachment 163414 [details] [review]
Bug 31791: Limit editing locked records

Sponsored-by: ByWater Solutions
Comment 22 Tomás Cohen Arazi 2024-03-19 11:39:56 UTC
Created attachment 163415 [details] [review]
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc)

Sponsored-by: ByWater Solutions
Comment 23 Tomás Cohen Arazi 2024-03-19 11:40:00 UTC
Created attachment 163416 [details] [review]
Bug 31791: Add x-record-source-id header to POST /biblios

This patch adds support for setting the record source on the API. It
does so by adding support for a new header `x-record-source-id`.

Setting the record source is restricted to patrons with the
`set_record_sources` permission.

A 403 error is returned on an attempt to set it without the correct
permissions.

The feature is documented on the spec.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass! Tests cover the right use cases!
3. Play with Postman (or similar)
4. Sign off :-D

Sponsored-by: ByWater Solutions
Comment 24 Martin Renvoize 2024-03-19 14:13:20 UTC
Created attachment 163426 [details] [review]
Bug 31791: Add Koha::Biblio->can_be_edited

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 25 Martin Renvoize 2024-03-19 14:13:24 UTC
Created attachment 163427 [details] [review]
Bug 31791: DB changes

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 26 Martin Renvoize 2024-03-19 14:13:26 UTC
Created attachment 163428 [details] [review]
Bug 31791: Add TT plugin method Biblio.CanBeEdited

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 27 Martin Renvoize 2024-03-19 14:13:29 UTC
Created attachment 163429 [details] [review]
Bug 31791: Add record locking based on source

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 28 Martin Renvoize 2024-03-19 14:13:32 UTC
Created attachment 163430 [details] [review]
Bug 31791: Add edit_locked_records and set_record_sources subpermissions

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 29 Martin Renvoize 2024-03-19 14:13:35 UTC
Created attachment 163431 [details] [review]
Bug 31791: Limit editing locked records

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 30 Martin Renvoize 2024-03-19 14:13:38 UTC
Created attachment 163432 [details] [review]
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc)

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 31 Martin Renvoize 2024-03-19 14:13:41 UTC
Created attachment 163433 [details] [review]
Bug 31791: Add x-record-source-id header to POST /biblios

This patch adds support for setting the record source on the API. It
does so by adding support for a new header `x-record-source-id`.

Setting the record source is restricted to patrons with the
`set_record_sources` permission.

A 403 error is returned on an attempt to set it without the correct
permissions.

The feature is documented on the spec.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass! Tests cover the right use cases!
3. Play with Postman (or similar)
4. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 32 Martin Renvoize 2024-03-19 14:13:44 UTC
Created attachment 163434 [details] [review]
Bug 31791: Remove CanBeEdited template helper

We've opted to rely on the objects directly in templates whenever we can
now. As such, I opt to remove this new template helper and use the
object method directly instead.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 33 Martin Renvoize 2024-03-19 14:14:51 UTC
All working great.. I added a small follow-up to remove the CanBeEdited helper as we can just use the object methods directly in the templates.

Signing off.
Comment 34 Martin Renvoize 2024-03-19 14:17:45 UTC
PS. We can squash my follow-up btw.. it'll throw git manipulation errors in the QA scripts as it stands.. though I tend to like the extra info of a commit myself.. but that's personal preference.. I know others prefer less commits.
Comment 35 Tomás Cohen Arazi 2024-03-20 14:28:07 UTC
Created attachment 163531 [details] [review]
Bug 31791: Add Koha::Biblio->can_be_edited

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 36 Tomás Cohen Arazi 2024-03-20 14:28:10 UTC
Created attachment 163532 [details] [review]
Bug 31791: DB changes

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 37 Tomás Cohen Arazi 2024-03-20 14:28:14 UTC
Created attachment 163533 [details] [review]
Bug 31791: Add record locking based on source

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 38 Tomás Cohen Arazi 2024-03-20 14:28:17 UTC
Created attachment 163534 [details] [review]
Bug 31791: Add edit_locked_records and set_record_sources subpermissions

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 39 Tomás Cohen Arazi 2024-03-20 14:28:21 UTC
Created attachment 163535 [details] [review]
Bug 31791: Limit editing locked records

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 40 Tomás Cohen Arazi 2024-03-20 14:28:24 UTC
Created attachment 163536 [details] [review]
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc)

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 41 Tomás Cohen Arazi 2024-03-20 14:28:27 UTC
Created attachment 163537 [details] [review]
Bug 31791: Add x-record-source-id header to POST /biblios

This patch adds support for setting the record source on the API. It
does so by adding support for a new header `x-record-source-id`.

Setting the record source is restricted to patrons with the
`set_record_sources` permission.

A 403 error is returned on an attempt to set it without the correct
permissions.

The feature is documented on the spec.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass! Tests cover the right use cases!
3. Play with Postman (or similar)
4. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 42 Tomás Cohen Arazi 2024-03-20 14:28:31 UTC
Created attachment 163538 [details] [review]
Bug 31791: Add Koha::Biblio::Metadata->record_source

This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object.

The method is covered by tests:

1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Sponsored-by: ByWater Solutions
Comment 43 Tomás Cohen Arazi 2024-03-20 14:28:34 UTC
Created attachment 163539 [details] [review]
Bug 31791: Display record source on the detail view
Comment 44 Tomás Cohen Arazi 2024-03-20 14:30:42 UTC
(In reply to Martin Renvoize from comment #33)
> All working great.. I added a small follow-up to remove the CanBeEdited
> helper as we can just use the object methods directly in the templates.

Oh, an oversight of mine. I had written this code before that decision was made!

(In reply to Martin Renvoize from comment #34)
> PS. We can squash my follow-up btw

Done!
Comment 45 Tomás Cohen Arazi 2024-03-20 14:33:29 UTC
I wanted to note that theres a 'tidy' warning regarding the C4::Biblio changes. They would only go away by tidying the entire sub, as the problem is my patch is adding lines to a fully untidy block.

I'll submit a follow-up for tidying it all, but I wouldn't push it myself. Up to the RM.
Comment 46 Tomás Cohen Arazi 2024-03-20 14:36:04 UTC
Created attachment 163545 [details] [review]
Bug 31791: (follow-up) Tidy AddBiblio

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 47 Tomás Cohen Arazi 2024-04-01 14:46:56 UTC
Created attachment 164193 [details] [review]
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc)

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 48 Tomás Cohen Arazi 2024-04-01 14:47:00 UTC
Created attachment 164194 [details] [review]
Bug 31791: Add x-record-source-id header to POST /biblios

This patch adds support for setting the record source on the API. It
does so by adding support for a new header `x-record-source-id`.

Setting the record source is restricted to patrons with the
`set_record_sources` permission.

A 403 error is returned on an attempt to set it without the correct
permissions.

The feature is documented on the spec.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass! Tests cover the right use cases!
3. Play with Postman (or similar)
4. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 49 Tomás Cohen Arazi 2024-04-01 14:47:03 UTC
Created attachment 164195 [details] [review]
Bug 31791: Add Koha::Biblio::Metadata->record_source

This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object.

The method is covered by tests:

1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Sponsored-by: ByWater Solutions
Comment 50 Tomás Cohen Arazi 2024-04-01 14:47:07 UTC
Created attachment 164196 [details] [review]
Bug 31791: Display record source on the detail view
Comment 51 Tomás Cohen Arazi 2024-04-01 14:47:11 UTC
Created attachment 164197 [details] [review]
Bug 31791: (follow-up) Tidy AddBiblio

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 52 Tomás Cohen Arazi 2024-04-01 14:47:41 UTC
Rebased on top of bug 34943, currently in master.
Comment 53 Lucas Gass 2024-04-11 13:38:41 UTC
Created attachment 164696 [details] [review]
Bug 31791: Add Koha::Biblio->can_be_edited

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 54 Lucas Gass 2024-04-11 13:38:44 UTC
Created attachment 164697 [details] [review]
Bug 31791: DB changes

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 55 Lucas Gass 2024-04-11 13:38:47 UTC
Created attachment 164698 [details] [review]
Bug 31791: Add record locking based on source

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 56 Lucas Gass 2024-04-11 13:38:50 UTC
Created attachment 164699 [details] [review]
Bug 31791: Add edit_locked_records and set_record_sources subpermissions

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 57 Lucas Gass 2024-04-11 13:38:54 UTC
Created attachment 164700 [details] [review]
Bug 31791: Limit editing locked records

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 58 Lucas Gass 2024-04-11 13:38:57 UTC
Created attachment 164701 [details] [review]
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc)

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 59 Lucas Gass 2024-04-11 13:39:00 UTC
Created attachment 164702 [details] [review]
Bug 31791: Add x-record-source-id header to POST /biblios

This patch adds support for setting the record source on the API. It
does so by adding support for a new header `x-record-source-id`.

Setting the record source is restricted to patrons with the
`set_record_sources` permission.

A 403 error is returned on an attempt to set it without the correct
permissions.

The feature is documented on the spec.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass! Tests cover the right use cases!
3. Play with Postman (or similar)
4. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 60 Lucas Gass 2024-04-11 13:39:04 UTC
Created attachment 164703 [details] [review]
Bug 31791: Add Koha::Biblio::Metadata->record_source

This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object.

The method is covered by tests:

1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 61 Lucas Gass 2024-04-11 13:39:07 UTC
Created attachment 164704 [details] [review]
Bug 31791: Display record source on the detail view

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 62 Lucas Gass 2024-04-11 13:39:10 UTC
Created attachment 164705 [details] [review]
Bug 31791: (follow-up) Tidy AddBiblio

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 63 Martin Renvoize 2024-04-11 13:55:30 UTC
Upgrading my SO to a QA.. I've thoroughly tested again, QA scripts are happy and tests coverage is good.

I can see lots of refinements for the future I'll add as bugs now.

Great work
Comment 64 Arthur Suzuki 2024-04-18 08:06:19 UTC
Created attachment 165044 [details] [review]
Bug 31791: Add Koha::Biblio->can_be_edited

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 65 Arthur Suzuki 2024-04-18 08:06:23 UTC
Created attachment 165045 [details] [review]
Bug 31791: DB changes

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 66 Arthur Suzuki 2024-04-18 08:06:26 UTC
Created attachment 165046 [details] [review]
Bug 31791: Add record locking based on source

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 67 Arthur Suzuki 2024-04-18 08:06:29 UTC
Created attachment 165047 [details] [review]
Bug 31791: Add edit_locked_records and set_record_sources subpermissions

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 68 Arthur Suzuki 2024-04-18 08:06:33 UTC
Created attachment 165048 [details] [review]
Bug 31791: Limit editing locked records

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 69 Arthur Suzuki 2024-04-18 08:06:37 UTC
Created attachment 165049 [details] [review]
Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc)

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 70 Arthur Suzuki 2024-04-18 08:06:40 UTC
Created attachment 165050 [details] [review]
Bug 31791: Add x-record-source-id header to POST /biblios

This patch adds support for setting the record source on the API. It
does so by adding support for a new header `x-record-source-id`.

Setting the record source is restricted to patrons with the
`set_record_sources` permission.

A 403 error is returned on an attempt to set it without the correct
permissions.

The feature is documented on the spec.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass! Tests cover the right use cases!
3. Play with Postman (or similar)
4. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 71 Arthur Suzuki 2024-04-18 08:06:43 UTC
Created attachment 165051 [details] [review]
Bug 31791: Add Koha::Biblio::Metadata->record_source

This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object.

The method is covered by tests:

1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Biblio/Metadata.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Sponsored-by: ByWater Solutions
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 72 Arthur Suzuki 2024-04-18 08:06:46 UTC
Created attachment 165052 [details] [review]
Bug 31791: Display record source on the detail view

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 73 Arthur Suzuki 2024-04-18 08:06:50 UTC
Created attachment 165053 [details] [review]
Bug 31791: (follow-up) Tidy AddBiblio

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 74 Arthur Suzuki 2024-04-18 08:08:29 UTC
Added my signoff, this is very good work and we have a use case for this.
Would be nice to have some interface to change the record source from staff interface but there is an attached bug for that (bz36372)
Comment 75 Katrin Fischer 2024-04-26 16:38:03 UTC
If I understand correctly, this patch set makes the record locks work, but they still need to be set in the database or by API.

I am mostly OK with that, but we also add a permission for "Set record source" and this doesn't seem to be included yet.

Maybe we should comment/remove it for now?
Comment 76 Katrin Fischer 2024-04-26 17:06:41 UTC
Talked to Tomas: we will try to finish bug 36373. If we don't manage in time for 24.05, we can add a little note to the permission that it's only relevant for API users for now.
Comment 77 Katrin Fischer 2024-04-26 18:19:27 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 78 Tomás Cohen Arazi 2024-04-26 20:20:17 UTC
Created attachment 165697 [details] [review]
Bug 31791: (follow-up) Fix Permissions.t

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