Bug 15497 - Limit item types by library
Summary: Limit item types by library
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement with 10 votes (vote)
Assignee: Agustín Moyano
QA Contact: Martin Renvoize
URL: http://devs.bywatersolutions.com/proj...
Keywords:
Depends on: 17755 23281 23599
Blocks: 23602
  Show dependency treegraph
 
Reported: 2016-01-06 16:36 UTC by Nicole C. Engard
Modified: 2020-11-30 21:44 UTC (History)
14 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement adds the ability to limit the use of item types by branch. This will allow libraries in large library systems or consortia to have their own item types.
Version(s) released in:
19.11.00


Attachments
Bug 15497: Add itemtypes_branches table and atomic update (2.47 KB, patch)
2019-07-06 04:05 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 15497: Modify schemas (4.39 KB, patch)
2019-07-06 04:05 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 15497: Limit itemtypes by branch in additem.pl (9.00 KB, patch)
2019-07-06 04:05 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 15497: Remove use of Data::Printer (792 bytes, patch)
2019-07-10 15:04 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 15497: Add itemtypes_branches table and atomic update (2.47 KB, patch)
2019-07-10 23:01 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 15497: Modify schemas (4.39 KB, patch)
2019-07-10 23:02 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 15497: Limit itemtypes by branch in additem.pl (8.68 KB, patch)
2019-07-10 23:02 UTC, Agustín Moyano
Details | Diff | Splinter Review
Bug 15497: Limit itemtypes by branch in additem.pl (8.77 KB, patch)
2019-07-11 19:27 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 15497: Add itemtypes_branches table and atomic update (2.52 KB, patch)
2019-09-12 14:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 15497: Modify schemas (4.44 KB, patch)
2019-09-12 14:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 15497: Limit itemtypes by branch in additem.pl (8.79 KB, patch)
2019-09-12 14:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 15497: (QA follow-up) Use the methods from bug 23281 instead (1.97 KB, patch)
2019-09-12 14:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 15497: (QA follow-up) Fix call in search_with_localization (907 bytes, patch)
2019-09-12 14:58 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 15497: Add itemtypes_branches table and atomic update (2.64 KB, patch)
2019-09-12 15:22 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: Modify schemas (4.56 KB, patch)
2019-09-12 15:22 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: Limit itemtypes by branch in additem.pl (8.85 KB, patch)
2019-09-12 15:22 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: (QA follow-up) Use the methods from bug 23281 instead (2.03 KB, patch)
2019-09-12 15:22 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: (QA follow-up) Fix call in search_with_localization (972 bytes, patch)
2019-09-12 15:22 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: Add itemtypes_branches table and atomic update (2.77 KB, patch)
2019-09-12 15:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: Modify schemas (4.71 KB, patch)
2019-09-12 15:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: Limit itemtypes by branch in additem.pl (9.00 KB, patch)
2019-09-12 15:29 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: (QA follow-up) Use the methods from bug 23281 instead (2.04 KB, patch)
2019-09-12 15:29 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 15497: (QA follow-up) Fix call in search_with_localization (972 bytes, patch)
2019-09-12 15:29 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2016-01-06 16:36:02 UTC
Work to be done:

* Create new table itemtype_branches similar to authorised_values_branches

* Add branch selector to itemtypes editor similar to branch limiter for authorised values

* Create subroutine to return only itemtypes for logged in branch

* Replace itemtype select in additem.pl with call to aforementioned subroutine 



Seeking Co-sponsors: http://devs.bywatersolutions.com/projects/limit-item-types-by-branch/
Comment 1 AspenCat Team 2019-01-07 22:39:49 UTC
We are a large consortium -- this would definitely be of benefit to us.
Comment 2 Lisette Scheer 2019-01-08 20:44:59 UTC
http://devs.bywatersolutions.com/2016/11/30/Limit-Item-Types-by-Branch/ 
According to the updated dev site on Bywater it looks like this has been funded. 
Lisette
Comment 3 Marjorie Barry-Vila 2019-05-23 14:21:27 UTC
+1
Comment 4 Agustín Moyano 2019-07-06 04:05:06 UTC
Created attachment 91377 [details] [review]
Bug 15497: Add itemtypes_branches table and atomic update
Comment 5 Agustín Moyano 2019-07-06 04:05:10 UTC
Created attachment 91378 [details] [review]
Bug 15497: Modify schemas
Comment 6 Agustín Moyano 2019-07-06 04:05:15 UTC
Created attachment 91379 [details] [review]
Bug 15497: Limit itemtypes by branch in additem.pl

This patch adds a select multiple when you add/edit an itemtype, creates functions to return itemtypes by library, and filters the options of itemtype select in additem

To test:
1) Apply this patch set
2) perl installer/data/mysql/updatedatabase.pl
3) In koha administration => item types, edit "Books" itemtype
CHECK => there is now a select multiple whith libraries at the bottom
4) select centerville and save
5) set centerville as current libary
6) search for any biblio in the catalog
7) click on "edit items"
CHECK => book item type is present
8) set any other libary as current library
SUCCESS => book item type is not present
9) Sign off
Comment 7 Kyle M Hall 2019-07-10 15:04:04 UTC
Created attachment 91446 [details] [review]
Bug 15497: Remove use of Data::Printer
Comment 8 Jessie Zairo 2019-07-10 17:51:07 UTC
When testing, I get to Administration > Itemtypes> Edit > select Centerville > Save and I get the following error 

Undefined subroutine &CGI::Compile::ROOT::kohadevbox_koha_admin_itemtypes_2epl::p called at /kohadevbox/koha/admin/itemtypes.pl line 202.
 at /kohadevbox/koha/admin/itemtypes.pl line 201
Comment 9 Agustín Moyano 2019-07-10 23:01:59 UTC
Created attachment 91450 [details] [review]
Bug 15497: Add itemtypes_branches table and atomic update
Comment 10 Agustín Moyano 2019-07-10 23:02:04 UTC
Created attachment 91451 [details] [review]
Bug 15497: Modify schemas
Comment 11 Agustín Moyano 2019-07-10 23:02:07 UTC
Created attachment 91452 [details] [review]
Bug 15497: Limit itemtypes by branch in additem.pl

This patch adds a select multiple when you add/edit an itemtype, creates functions to return itemtypes by library, and filters the options of itemtype select in additem

To test:
1) Apply this patch set
2) perl installer/data/mysql/updatedatabase.pl
3) In koha administration => item types, edit "Books" itemtype
CHECK => there is now a select multiple whith libraries at the bottom
4) select centerville and save
5) set centerville as current libary
6) search for any biblio in the catalog
7) click on "edit items"
CHECK => book item type is present
8) set any other libary as current library
SUCCESS => book item type is not present
9) Sign off
Comment 12 Agustín Moyano 2019-07-10 23:03:13 UTC
(In reply to Jessie Zairo from comment #8)
> When testing, I get to Administration > Itemtypes> Edit > select Centerville
> > Save and I get the following error 
> 
> Undefined subroutine
> &CGI::Compile::ROOT::kohadevbox_koha_admin_itemtypes_2epl::p called at
> /kohadevbox/koha/admin/itemtypes.pl line 202.
>  at /kohadevbox/koha/admin/itemtypes.pl line 201

Sorry, my bad.. forgot to cleanup debug statements.

Please try again
Comment 13 ByWater Sandboxes 2019-07-11 19:27:31 UTC
Created attachment 91469 [details] [review]
Bug 15497: Limit itemtypes by branch in additem.pl

This patch adds a select multiple when you add/edit an itemtype, creates functions to return itemtypes by library, and filters the options of itemtype select in additem

To test:
1) Apply this patch set
2) perl installer/data/mysql/updatedatabase.pl
3) In koha administration => item types, edit "Books" itemtype
CHECK => there is now a select multiple whith libraries at the bottom
4) select centerville and save
5) set centerville as current libary
6) search for any biblio in the catalog
7) click on "edit items"
CHECK => book item type is present
8) set any other libary as current library
SUCCESS => book item type is not present
9) Sign off

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Comment 14 Katrin Fischer 2019-08-17 19:29:23 UTC
I think this shoudl depend on bug 23281?

+use base qw(Koha::Object Koha::Object::Limit::Library);
Comment 15 Tomás Cohen Arazi 2019-09-12 14:18:08 UTC
Created attachment 92725 [details] [review]
Bug 15497: Add itemtypes_branches table and atomic update

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 16 Tomás Cohen Arazi 2019-09-12 14:18:13 UTC
Created attachment 92726 [details] [review]
Bug 15497: Modify schemas

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 17 Tomás Cohen Arazi 2019-09-12 14:18:18 UTC
Created attachment 92727 [details] [review]
Bug 15497: Limit itemtypes by branch in additem.pl

This patch adds a select multiple when you add/edit an itemtype, creates functions to return itemtypes by library, and filters the options of itemtype select in additem

To test:
1) Apply this patch set
2) perl installer/data/mysql/updatedatabase.pl
3) In koha administration => item types, edit "Books" itemtype
CHECK => there is now a select multiple whith libraries at the bottom
4) select centerville and save
5) set centerville as current libary
6) search for any biblio in the catalog
7) click on "edit items"
CHECK => book item type is present
8) set any other libary as current library
SUCCESS => book item type is not present
9) Sign off

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 18 Tomás Cohen Arazi 2019-09-12 14:18:23 UTC
Created attachment 92728 [details] [review]
Bug 15497: (QA follow-up) Use the methods from bug 23281 instead

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 19 Tomás Cohen Arazi 2019-09-12 14:23:19 UTC
(In reply to Katrin Fischer from comment #14)
> I think this shoudl depend on bug 23281?
> 
> +use base qw(Koha::Object Koha::Object::Limit::Library);

That was correct boss, it is just that Agustin wrote this and then I realized we had to have 23281 and stop repeating code.

Thanks for pointing it out!
Comment 20 Tomás Cohen Arazi 2019-09-12 14:58:45 UTC
Created attachment 92732 [details] [review]
Bug 15497: (QA follow-up) Fix call in search_with_localization

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 21 Martin Renvoize 2019-09-12 15:22:19 UTC
Created attachment 92735 [details] [review]
Bug 15497: Add itemtypes_branches table and atomic update

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 22 Martin Renvoize 2019-09-12 15:22:23 UTC
Created attachment 92736 [details] [review]
Bug 15497: Modify schemas

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize 2019-09-12 15:22:26 UTC
Created attachment 92737 [details] [review]
Bug 15497: Limit itemtypes by branch in additem.pl

This patch adds a select multiple when you add/edit an itemtype, creates functions to return itemtypes by library, and filters the options of itemtype select in additem

To test:
1) Apply this patch set
2) perl installer/data/mysql/updatedatabase.pl
3) In koha administration => item types, edit "Books" itemtype
CHECK => there is now a select multiple whith libraries at the bottom
4) select centerville and save
5) set centerville as current libary
6) search for any biblio in the catalog
7) click on "edit items"
CHECK => book item type is present
8) set any other libary as current library
SUCCESS => book item type is not present
9) Sign off

Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 24 Martin Renvoize 2019-09-12 15:22:30 UTC
Created attachment 92738 [details] [review]
Bug 15497: (QA follow-up) Use the methods from bug 23281 instead

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 25 Martin Renvoize 2019-09-12 15:22:35 UTC
Created attachment 92739 [details] [review]
Bug 15497: (QA follow-up) Fix call in search_with_localization

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 26 Martin Renvoize 2019-09-12 15:25:05 UTC
All works well for me and passes QA scripts... No obvious regressions.

Passing QA.

Some minor additions in the future might be nice.. there's nothing that ties this in at the circ rules level.. one can still create a circ rule at any branch with any itemtype for example and there's nothing to prevent an item being permanently transferred to the branch without that itemtype and as such you end up with an incorrectly types item at that branch.

I don't see either of the above as failure points, but perhaps worth mentioning and perhaps a followup bug creating to document these shortcomings.
Comment 27 Tomás Cohen Arazi 2019-09-12 15:27:50 UTC
(In reply to Martin Renvoize from comment #26)
> All works well for me and passes QA scripts... No obvious regressions.
> 
> Passing QA.

Thanks!

> Some minor additions in the future might be nice.. there's nothing that ties
> this in at the circ rules level.. one can still create a circ rule at any
> branch with any itemtype for example and there's nothing to prevent an item
> being permanently transferred to the branch without that itemtype and as
> such you end up with an incorrectly types item at that branch.
> 
> I don't see either of the above as failure points, but perhaps worth
> mentioning and perhaps a followup bug creating to document these
> shortcomings.

I'm sure the consortia that sponsored this dev will have interesting additions and requests to make now that this is in master and can have a real-life test drive!
Comment 28 Martin Renvoize 2019-09-12 15:28:54 UTC
Created attachment 92741 [details] [review]
Bug 15497: Add itemtypes_branches table and atomic update

Sponsored-by: Northeast Kansas Library System
Sponsored-by: Southeast Kansas Library System
Sponsored-by: Central Kansas Library System
Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 29 Martin Renvoize 2019-09-12 15:28:59 UTC
Created attachment 92742 [details] [review]
Bug 15497: Modify schemas

Sponsored-by: Northeast Kansas Library System
Sponsored-by: Southeast Kansas Library System
Sponsored-by: Central Kansas Library System
Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 30 Martin Renvoize 2019-09-12 15:29:04 UTC
Created attachment 92743 [details] [review]
Bug 15497: Limit itemtypes by branch in additem.pl

This patch adds a select multiple when you add/edit an itemtype, creates functions to return itemtypes by library, and filters the options of itemtype select in additem

To test:
1) Apply this patch set
2) perl installer/data/mysql/updatedatabase.pl
3) In koha administration => item types, edit "Books" itemtype
CHECK => there is now a select multiple whith libraries at the bottom
4) select centerville and save
5) set centerville as current libary
6) search for any biblio in the catalog
7) click on "edit items"
CHECK => book item type is present
8) set any other libary as current library
SUCCESS => book item type is not present
9) Sign off

Sponsored-by: Northeast Kansas Library System
Sponsored-by: Southeast Kansas Library System
Sponsored-by: Central Kansas Library System
Signed-off-by: Jessica Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 31 Martin Renvoize 2019-09-12 15:29:09 UTC
Created attachment 92744 [details] [review]
Bug 15497: (QA follow-up) Use the methods from bug 23281 instead

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 32 Martin Renvoize 2019-09-12 15:29:13 UTC
Created attachment 92745 [details] [review]
Bug 15497: (QA follow-up) Fix call in search_with_localization

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 33 Martin Renvoize 2019-09-12 15:30:04 UTC
Sponsor lines moved into commit message so they're caught by the release notes script.

Thankyou Northeast Kansas Library System, Southeast Kansas Library System and Central Kansas Library System.
Comment 34 Martin Renvoize 2019-09-12 15:33:20 UTC
Nice work!

Pushed to master for 19.11.00
Comment 35 Fridolin Somers 2019-09-13 12:56:29 UTC
Enhancement not pushed to 19.05.x
Comment 36 Katrin Fischer 2019-09-15 17:50:22 UTC
> > Some minor additions in the future might be nice.. there's nothing that ties
> > this in at the circ rules level.. one can still create a circ rule at any
> > branch with any itemtype for example and there's nothing to prevent an item
> > being permanently transferred to the branch without that itemtype and as
> > such you end up with an incorrectly types item at that branch.
> > 
> > I don't see either of the above as failure points, but perhaps worth
> > mentioning and perhaps a followup bug creating to document these
> > shortcomings.
> 
> I'm sure the consortia that sponsored this dev will have interesting
> additions and requests to make now that this is in master and can have a
> real-life test drive!

I think both those might be desirable behaviour for some workflows, so happy to see what's to come too :)
Comment 37 Caroline Cyr La Rose 2019-12-20 21:56:27 UTC
Added release notes and manual patch (in gitlab).