Bug 14393 - Add collection code filter to inventory
Summary: Add collection code filter to inventory
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: David Cook
QA Contact: Kyle M Hall (khall)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-16 05:17 UTC by David Cook
Modified: 2022-12-12 21:24 UTC (History)
12 users (show)

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


Attachments
Bug 14393 - Add collection code filter to inventory (8.71 KB, patch)
2015-06-17 05:02 UTC, David Cook
Details | Diff | Splinter Review
[Signed-off] Bug 14393 - Add collection code filter to inventory (8.90 KB, patch)
2015-06-18 08:48 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 14393 - Add collection code filter to inventory (9.54 KB, patch)
2015-07-13 06:36 UTC, David Cook
Details | Diff | Splinter Review
Bug 14393 - Add collection code filter to inventory (9.74 KB, patch)
2015-11-11 16:15 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 14393 - Add collection code filter to inventory (9.19 KB, patch)
2022-02-22 19:38 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 14393 - Add collection code filter to inventory (9.24 KB, patch)
2022-03-11 19:49 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14393 - Add collection code filter to inventory (9.24 KB, patch)
2022-03-11 19:51 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 14393: Add collection code filter to inventory (9.24 KB, patch)
2022-03-31 15:32 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 14393: (QA follow-up) Add template filters (1.98 KB, patch)
2022-03-31 15:33 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2015-06-16 05:17:34 UTC
Add the ability to do inventory by collection code as well.
Comment 1 David Cook 2015-06-16 06:51:22 UTC
I think that this should actually be fairly straightforward.

I should have a patch for this tomorrow...
Comment 2 David Cook 2015-06-17 05:02:21 UTC Comment hidden (obsolete)
Comment 3 Marc Véron 2015-06-18 08:48:46 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-06-18 11:53:17 UTC
David,

In my dev installation, items.ccode is not mapped.
Which makes the dropdown list populated with all my authorized values :)
You certainly need to care about the value of AdvancedSearchTypes, you will have to propose item type too.

Marked as Failed QA.
Comment 5 David Cook 2015-06-21 23:46:29 UTC
(In reply to Jonathan Druart from comment #4)
> David,
> 
> In my dev installation, items.ccode is not mapped.
> Which makes the dropdown list populated with all my authorized values :)
> You certainly need to care about the value of AdvancedSearchTypes, you will
> have to propose item type too.
> 
> Marked as Failed QA.

I'm not sure what you mean by "You certainly need to care about the value of AdvancedSearchTypes, you will have to propose item type too". Could you clarify?

I'll look into the problem with the mapping in the meantime though :)
Comment 6 Jonathan Druart 2015-06-22 11:13:07 UTC
(In reply to David Cook from comment #5)
> (In reply to Jonathan Druart from comment #4)
> > David,
> > 
> > In my dev installation, items.ccode is not mapped.
> > Which makes the dropdown list populated with all my authorized values :)
> > You certainly need to care about the value of AdvancedSearchTypes, you will
> > have to propose item type too.
> > 
> > Marked as Failed QA.
> 
> I'm not sure what you mean by "You certainly need to care about the value of
> AdvancedSearchTypes, you will have to propose item type too". Could you
> clarify?

Some libraries don't use this ccode value, it's the case in my installation.
I this case, the dropdown list is wrongly populated with all authorized values!
Comment 7 David Cook 2015-06-23 05:23:17 UTC
(In reply to Jonathan Druart from comment #6)
> Some libraries don't use this ccode value, it's the case in my installation.
> I this case, the dropdown list is wrongly populated with all authorized
> values!

Cool beans. I'll look into it :)
Comment 8 David Cook 2015-07-13 06:36:45 UTC Comment hidden (obsolete)
Comment 9 David Cook 2015-07-13 06:37:57 UTC
(In reply to Jonathan Druart from comment #6)
> Some libraries don't use this ccode value, it's the case in my installation.
> I this case, the dropdown list is wrongly populated with all authorized
> values!

Could you give that a look? That should be a lot better now... thanks for looking at this bug!
Comment 10 Frédéric Demians 2015-11-11 16:08:30 UTC
> Could you give that a look? That should be a lot better now... thanks for
> looking at this bug!

Comment 6 is solved. When items.ccode isn't linked to a populated AV list, the collection code selection list isn't displayed in Inventory.

I see that in the inventory result table, there is a new columun 'Collection code' which is displayed even when there isn't CCODE AV. Do you think there is a way to display or not this column?
Comment 11 Frédéric Demians 2015-11-11 16:15:25 UTC
Created attachment 44772 [details] [review]
Bug 14393 - Add collection code filter to inventory

This patch adds the ability to do inventory by collection.

_TEST PLAN_

Before applying:
1) Go to "Tools > Inventory/stocktaking"
2) Note that there is no "Collection code:" option

Optionally:
2b) You can create a Barcode file with a single barcode
2c) Don't select anything from "Select items you want to check" (or filter if you know
how to filter to make it faster... doesn't matter)
2d) Click "Submit" at the bottom of the screen
2e) Note that there is no "Collection code" column in the screen output or CSV output
(ie with/without the "Export to CSV file" box ticked before submitting)

Apply the patch.

After applying:
3) Note that there is a "Collection code" filter on the main inventory screen
4) Create a Barcode file with a single barcode for an item with a collection
and upload it using the "Choose file" button.
5) Select that item's collection code from the "Collection code" filter
6) Click "Submit"
7) Note that the screen output and the CSV output contains a "Collection code" column
(ie with/without the "Export to CSV file" box ticked before submitting)

Note: Collection code isn't displayed on Inventory filter & result if ccode
isn't used in items.

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
Comment 12 Frédéric Demians 2015-11-11 16:17:23 UTC
(In reply to Frédéric Demians from comment #10)

> I see that in the inventory result table, there is a new columun 'Collection
> code' which is displayed even when there isn't CCODE AV. Do you think there
> is a way to display or not this column?

Forget this. I've added a [% IF %] in your patch that I've signed off in order to not display this column when unnecessary.
Comment 13 Jonathan Druart 2015-12-02 09:48:16 UTC
Comment on attachment 44772 [details] [review]
Bug 14393 - Add collection code filter to inventory

Review of attachment 44772 [details] [review]:
-----------------------------------------------------------------

::: tools/inventory.pl
@@ +95,5 @@
>        }
>        push @authorised_value_list,@$data;
>      }
> +
> +    my $collection_authorised_value = C4::Koha::GetAuthValCode("items.ccode", $fwkcode);

Does it really necessary to check all frameworks?
Isn't be enough to get the default one?
Comment 14 David Cook 2015-12-02 22:39:13 UTC
(In reply to Frédéric Demians from comment #12)
> Forget this. I've added a [% IF %] in your patch that I've signed off in
> order to not display this column when unnecessary.

Cheers, Frédéric :)
Comment 15 David Cook 2015-12-02 22:44:09 UTC
Comment on attachment 44772 [details] [review]
Bug 14393 - Add collection code filter to inventory

Review of attachment 44772 [details] [review]:
-----------------------------------------------------------------

::: tools/inventory.pl
@@ +95,5 @@
>        }
>        push @authorised_value_list,@$data;
>      }
> +
> +    my $collection_authorised_value = C4::Koha::GetAuthValCode("items.ccode", $fwkcode);

In practice, it might be enough to get the default one, but in theory you could use different authorized value categories than "CCODE" for "item.ccode" depending on the framework of the biblio to which an item is attached.

Originally, I just used the default framework, but then realized that it wasn't necessarily comprehensive enough. In practice, I don't know if anyone would map multiple categories to "item.ccode", but it is theoretically possible. You might only allow certain collections for a certain framework. Framework A might use "CCODE" which refers to textual collections while Framework B might use "CCODE2"which refers to audiovisual collections. That would probably be madness, but it's possible madness.
Comment 16 David Cook 2015-12-02 22:44:42 UTC
^ that last comment was for Jonathan. Perhaps I should've just replied to the comment rather than on the splinter review...
Comment 17 Katrin Fischer 2015-12-02 22:53:40 UTC
You are right, it's theoretically possible... but in my opinoin not recommendable. Think about features like item batch editing or any search form/report that offers you a list of collections. It will cause lots of inconvenience if someone does that. I think we don't need to cover this possibility.
Comment 18 David Cook 2015-12-02 23:09:30 UTC
(In reply to Katrin Fischer from comment #17)
> You are right, it's theoretically possible... but in my opinoin not
> recommendable. Think about features like item batch editing or any search
> form/report that offers you a list of collections. It will cause lots of
> inconvenience if someone does that. I think we don't need to cover this
> possibility.

Ok. I'm fine with that. I was mostly just following the pattern that already existed in the script. Other things than collection code do this same check. Should a follow-up remove this "all framework checking" for all criteria?
Comment 19 Jonathan Druart 2015-12-07 09:24:22 UTC
(In reply to David Cook from comment #18)
> (In reply to Katrin Fischer from comment #17)
> > You are right, it's theoretically possible... but in my opinoin not
> > recommendable. Think about features like item batch editing or any search
> > form/report that offers you a list of collections. It will cause lots of
> > inconvenience if someone does that. I think we don't need to cover this
> > possibility.
> 
> Ok. I'm fine with that. I was mostly just following the pattern that already
> existed in the script. Other things than collection code do this same check.
> Should a follow-up remove this "all framework checking" for all criteria?

I would prefer to keep it, to avoid undesired side-effects.
Comment 20 David Cook 2015-12-07 22:45:45 UTC
(In reply to Jonathan Druart from comment #19)
> I would prefer to keep it, to avoid undesired side-effects.

That also seems reasonable.

I'm happy to go with whatever QA decides in the end.
Comment 21 Charles Farmer 2019-01-04 21:59:20 UTC
Merging seems to fail because of HTML filters and whatnot, pretty expected from a 2015 patch.
Comment 22 David Cook 2019-01-06 23:18:09 UTC
(In reply to Charles Farmer from comment #21)
> Merging seems to fail because of HTML filters and whatnot, pretty expected
> from a 2015 patch.

Thanks for checking, Charles. 

Looks like the patch is 9474 commits behind master. Let me try rebasing it.

Not a trivial rebase at a glance. Will have to look at this more some other time.
Comment 23 David Cook 2020-03-02 06:23:58 UTC
I think I've recently ported this to 19.11, so I'll have another look at this soon.
Comment 24 Joy Nelson 2020-03-03 17:22:52 UTC
David-
Glad to hear this is still moving forward!  We have a library interested in this feature.  Let us know how we can help with testing/signoffs/QA etc!

Thanks
joy


(In reply to David Cook from comment #23)
> I think I've recently ported this to 19.11, so I'll have another look at
> this soon.
Comment 25 Shanna 2021-02-04 00:16:43 UTC
Hello, what a beautiful idea for a patch! As a librarian, it would make my inventory experience a thousand times better.  I am willing to learn whatever coding and conventions necessary, and make friends with every developer on this site, in order to learn how to implement this.  It's my first post and first bug and I am cheering you all on.
Comment 26 Shanna 2021-02-04 00:17:29 UTC
Hello, what a beautiful idea for a patch! As a librarian, it would make my inventory experience a thousand times better.  I am willing to learn whatever coding and conventions necessary, and make friends with every developer on this site, in order to learn how to implement this.  It's my first post and first bug and I am cheering you all on.
Comment 27 Nick Clemens (kidclamp) 2022-02-22 19:38:16 UTC
Created attachment 131025 [details] [review]
Bug 14393 - Add collection code filter to inventory

This patch adds the ability to do inventory by collection.

_TEST PLAN_

Before applying:
1) Go to "Tools > Inventory/stocktaking"
2) Note that there is no "Collection code:" option

Optionally:
2b) You can create a Barcode file with a single barcode
2c) Don't select anything from "Select items you want to check" (or filter if you know
how to filter to make it faster... doesn't matter)
2d) Click "Submit" at the bottom of the screen
2e) Note that there is no "Collection code" column in the screen output or CSV output
(ie with/without the "Export to CSV file" box ticked before submitting)

Apply the patch.

After applying:
3) Note that there is a "Collection code" filter on the main inventory screen
4) Create a Barcode file with a single barcode for an item with a collection
and upload it using the "Choose file" button.
5) Select that item's collection code from the "Collection code" filter
6) Click "Submit"
7) Note that the screen output and the CSV output contains a "Collection code" column
(ie with/without the "Export to CSV file" box ticked before submitting)
Comment 28 ByWater Sandboxes 2022-03-11 19:49:58 UTC
Created attachment 131627 [details] [review]
Bug 14393 - Add collection code filter to inventory

This patch adds the ability to do inventory by collection.

_TEST PLAN_

Before applying:
1) Go to "Tools > Inventory/stocktaking"
2) Note that there is no "Collection code:" option

Optionally:
2b) You can create a Barcode file with a single barcode
2c) Don't select anything from "Select items you want to check" (or filter if you know
how to filter to make it faster... doesn't matter)
2d) Click "Submit" at the bottom of the screen
2e) Note that there is no "Collection code" column in the screen output or CSV output
(ie with/without the "Export to CSV file" box ticked before submitting)

Apply the patch.

After applying:
3) Note that there is a "Collection code" filter on the main inventory screen
4) Create a Barcode file with a single barcode for an item with a collection
and upload it using the "Choose file" button.
5) Select that item's collection code from the "Collection code" filter
6) Click "Submit"
7) Note that the screen output and the CSV output contains a "Collection code" column
(ie with/without the "Export to CSV file" box ticked before submitting)

Signed-off-by: Jessica <jzairo@bywatersolutions.com>
Comment 29 ByWater Sandboxes 2022-03-11 19:51:36 UTC
Created attachment 131628 [details] [review]
Bug 14393 - Add collection code filter to inventory

This patch adds the ability to do inventory by collection.

_TEST PLAN_

Before applying:
1) Go to "Tools > Inventory/stocktaking"
2) Note that there is no "Collection code:" option

Optionally:
2b) You can create a Barcode file with a single barcode
2c) Don't select anything from "Select items you want to check" (or filter if you know
how to filter to make it faster... doesn't matter)
2d) Click "Submit" at the bottom of the screen
2e) Note that there is no "Collection code" column in the screen output or CSV output
(ie with/without the "Export to CSV file" box ticked before submitting)

Apply the patch.

After applying:
3) Note that there is a "Collection code" filter on the main inventory screen
4) Create a Barcode file with a single barcode for an item with a collection
and upload it using the "Choose file" button.
5) Select that item's collection code from the "Collection code" filter
6) Click "Submit"
7) Note that the screen output and the CSV output contains a "Collection code" column
(ie with/without the "Export to CSV file" box ticked before submitting)

Signed-off-by: kelly mcelligott <kpmcelligott@gmail.com>
Comment 30 Kyle M Hall (khall) 2022-03-31 15:32:59 UTC
Created attachment 132791 [details] [review]
Bug 14393: Add collection code filter to inventory

This patch adds the ability to do inventory by collection.

_TEST PLAN_

Before applying:
1) Go to "Tools > Inventory/stocktaking"
2) Note that there is no "Collection code:" option

Optionally:
2b) You can create a Barcode file with a single barcode
2c) Don't select anything from "Select items you want to check" (or filter if you know
how to filter to make it faster... doesn't matter)
2d) Click "Submit" at the bottom of the screen
2e) Note that there is no "Collection code" column in the screen output or CSV output
(ie with/without the "Export to CSV file" box ticked before submitting)

Apply the patch.

After applying:
3) Note that there is a "Collection code" filter on the main inventory screen
4) Create a Barcode file with a single barcode for an item with a collection
and upload it using the "Choose file" button.
5) Select that item's collection code from the "Collection code" filter
6) Click "Submit"
7) Note that the screen output and the CSV output contains a "Collection code" column
(ie with/without the "Export to CSV file" box ticked before submitting)

Signed-off-by: kelly mcelligott <kpmcelligott@gmail.com>
Comment 31 Kyle M Hall (khall) 2022-03-31 15:33:13 UTC
Created attachment 132792 [details] [review]
Bug 14393: (QA follow-up) Add template filters

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 32 Fridolin Somers 2022-04-08 13:51:12 UTC
There is actually no unit test for other filters so its OK.

We should work on more tests for inventory, and move code from pl to a module.
Comment 33 Fridolin Somers 2022-04-08 13:52:06 UTC
Pushed to master for 22.05, thanks to everybody involved ﷐[U+1F984]﷑