Bug 38663 - Add additional fields to libraries
Summary: Add additional fields to libraries
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Pedro Amorim
QA Contact: Testopia
URL:
Keywords:
Depends on: 38662
Blocks: 38457
  Show dependency treegraph
 
Reported: 2024-12-10 11:14 UTC by Pedro Amorim
Modified: 2024-12-17 17:11 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 38663: [DONT PUSH] Preparation: Change record_id to varchar: DBIC (1.54 KB, patch)
2024-12-10 15:18 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38663: Preparation: Change record_id to varchar: database (2.41 KB, patch)
2024-12-10 15:18 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38663: Add libraries table to additional fields admin screen (1.28 KB, patch)
2024-12-10 15:18 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38663: DBIC: Add AdditionalFields to Library (1.27 KB, patch)
2024-12-10 15:18 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38663: Add AdditionalFields to Library (4.84 KB, patch)
2024-12-10 15:18 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 38663: Add AdditionalFields to Library (5.21 KB, patch)
2024-12-11 10:30 UTC, Pedro Amorim
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2024-12-10 11:14:30 UTC

    
Comment 1 Pedro Amorim 2024-12-10 15:18:37 UTC
Created attachment 175355 [details] [review]
Bug 38663: [DONT PUSH] Preparation: Change record_id to varchar: DBIC
Comment 2 Pedro Amorim 2024-12-10 15:18:39 UTC
Created attachment 175356 [details] [review]
Bug 38663: Preparation: Change record_id to varchar: database

record_if in the additional_field_values is an int(11)
This works for most cases, but in the branches case, the id column is
actually a varchar (branchcode).
This patch updates the column to accomodate for this.
Comment 3 Pedro Amorim 2024-12-10 15:18:41 UTC
Created attachment 175357 [details] [review]
Bug 38663: Add libraries table to additional fields admin screen
Comment 4 Pedro Amorim 2024-12-10 15:18:43 UTC
Created attachment 175358 [details] [review]
Bug 38663: DBIC: Add AdditionalFields to Library
Comment 5 Pedro Amorim 2024-12-10 15:18:45 UTC
Created attachment 175359 [details] [review]
Bug 38663: Add AdditionalFields to Library

Test plan, k-t-d:
1) Add a new additional field to 'branches':
  <staff_url>/cgi-bin/koha/admin/additional-fields.pl?tablename=branches
2) Click 'New field'. Add a name. Click Save.
3) Repeat step 2 but repeatable. Repeat again for 2 more of AV category
   (one repeatable, one not repeatable)
4) Edit a library:
  <staff_url>/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode=CPL
5) Input various values in the different additional fields. Click
   'Submit'
6) Visit the detail page of the library and verify the additional fields
   data is displayed correctly:
<staff_url>/cgi-bin/koha/admin/branches.pl?op=view&branchcode=CPL
Comment 6 Pedro Amorim 2024-12-11 10:30:51 UTC
Created attachment 175370 [details] [review]
Bug 38663: Add AdditionalFields to Library

Test plan, k-t-d:
1) Add a new additional field to 'branches':
  <staff_url>/cgi-bin/koha/admin/additional-fields.pl?tablename=branches
2) Click 'New field'. Add a name. Click Save.
3) Repeat step 2 but repeatable. Repeat again for 2 more of AV category
   (one repeatable, one not repeatable)
4) Edit a library:
  <staff_url>/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode=CPL
5) Input various values in the different additional fields. Click
   'Submit'
6) Visit the detail page of the library and verify the additional fields
   data is displayed correctly:
<staff_url>/cgi-bin/koha/admin/branches.pl?op=view&branchcode=CPL
Comment 7 David Cook 2024-12-12 04:21:26 UTC
It's a good question. Historically, I think we'd say branches should be converted to have a branch_id. 

Once upon a time, reserve_id didn't exist (see Bug 7065), but that was a long time ago and a different set of circumstances... (e.g. it didn't have a primary key at all)

Technically, I suppose we could keep branchcode as the PK, and maybe just add an autoincrementing branch_id int(11) with a UNIQUE constraint. 

I don't know enough about additional_field_values to know if that would be workable or not though
Comment 8 David Cook 2024-12-12 04:23:01 UTC
One day, it would be cool to switch from autoincrementing integers to UUIDs, which are less prone to enumeration attacks, but that's a whole other story...