Bug 9525 - Add option to define float groups and rules for float
Summary: Add option to define float groups and rules for float
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature (vote)
Assignee: Emmi Takkinen
QA Contact:
URL:
Keywords:
Depends on: 14187 14188
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-31 20:25 UTC by Nicole C. Engard
Modified: 2021-09-13 08:05 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Large patch
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 9525 - group floating rules (82.98 KB, patch)
2015-06-10 13:59 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Admin menu screenshot, how to navigate to the control panel (93.62 KB, image/png)
2015-06-12 12:22 UTC, Olli-Antti Kivilahti
Details
The floating matrix control panel where you configure the 4 types of floating between routes. (168.92 KB, image/png)
2015-06-12 12:22 UTC, Olli-Antti Kivilahti
Details
Bug 9525 - group floating rules, floating rule tester :) (7.68 KB, patch)
2015-11-11 13:12 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 9525 - group floating rules, floating rule tester :) (9.71 KB, patch)
2015-11-11 13:14 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 9525 - group floating rules, CGI doesn't understand DELETE at all. (1.20 KB, patch)
2015-11-11 13:42 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 9525 - group floating rules - added logging ALWAYS and CODITIONAL floats. (1.88 KB, patch)
2016-02-23 09:54 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 9525: Group floating rules (71.49 KB, patch)
2020-03-10 08:29 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Fixing floating on return (2.75 KB, patch)
2020-03-10 08:46 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Add support for regexps in conditional floating clauses (11.57 KB, patch)
2020-03-10 08:49 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Group floating rules (73.51 KB, patch)
2020-03-16 12:13 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Fixing floating on return (2.74 KB, patch)
2020-03-16 12:13 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Add support for regexps in conditional floating (11.57 KB, patch)
2020-03-16 12:14 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Group floating rules (68.98 KB, patch)
2020-04-28 07:54 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Schema changes - DO NOT PUSH (4.23 KB, patch)
2020-04-28 07:54 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Fixing floating on return (2.07 KB, patch)
2020-04-28 07:55 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Add support for regexps in conditional floating clauses (11.57 KB, patch)
2020-04-28 07:56 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Group floating rules (69.00 KB, patch)
2020-10-27 10:58 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Schema changes - DO NOT PUSH (4.23 KB, patch)
2020-10-27 10:58 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Fixing floating on return (2.08 KB, patch)
2020-10-27 10:59 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Add support for regexps in conditional floating clauses (11.57 KB, patch)
2020-10-27 11:00 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Add ft_local_float_group column (2.46 KB, patch)
2021-09-13 07:18 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: DO NOT PUSH! Schema update (3.07 KB, patch)
2021-09-13 07:19 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 9525: Add option to define float groups and rules for float (18.03 KB, patch)
2021-09-13 07:20 UTC, Emmi Takkinen
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 2013-01-31 20:25:28 UTC
It would be handy if you could create groups for floating rules. Right now you can set an item type to float in the circ and fine rules, but there is no way to specific which branches it floats between. This would be a development for consortia so that nearby libraries can have floating collections but not necessarily the entire system.
Comment 1 Olli-Antti Kivilahti 2015-05-07 09:33:52 UTC
We need the same thing ASAP.
We just added a few bookmobiles which need floating between their parent libraries and are shifting priorities to try to solve this issue ASAP.
This is an awkward pending issue for us and hopefully I can deliver an acceptable solution soon.
Comment 2 Olli-Antti Kivilahti 2015-06-10 13:59:47 UTC
Created attachment 40077 [details] [review]
Bug 9525 - group floating rules

Cucumber integration tests included.
run t/Cucumber/runCucumberTests.pl --tags @floatingMatrix
Comment 3 Bernardo Gonzalez Kriegel 2015-06-12 11:51:46 UTC
Hi, nice feature!
Can you please add a test plan?

Also some files need a Licence and others need an updated one (from 2 -> 3)
Comment 4 Olli-Antti Kivilahti 2015-06-12 12:00:54 UTC
Hi Bernardo.

Sorry I must focus on other things. I am happy I even managed to rebase and push all things to bugzilla.
If you like it, you can write a test plan.
Tho I am 100% sure the dependencies will go stale in 1 week and then nobody but a programmer can test this :)

And that kind of testing implies a code review.
Comment 5 Olli-Antti Kivilahti 2015-06-12 12:01:11 UTC
But it is a nice feature and works remarkably well for us.
Comment 6 Bernardo Gonzalez Kriegel 2015-06-12 12:12:14 UTC
(In reply to Olli-Antti Kivilahti from comment #5)
> But it is a nice feature and works remarkably well for us.

Great :)

Is it possible a short description of the use case scenario?
Comment 7 Olli-Antti Kivilahti 2015-06-12 12:22:02 UTC
Created attachment 40102 [details]
Admin menu screenshot, how to navigate to the control panel
Comment 8 Olli-Antti Kivilahti 2015-06-12 12:22:40 UTC
Created attachment 40103 [details]
The floating matrix control panel where you configure the 4 types of floating between routes.
Comment 9 Olli-Antti Kivilahti 2015-06-12 12:24:45 UTC
This screenshot:
The floating matrix control panel where you configure the 4 types of floating between routes.

Explains how to use this feature.



Then just check-in Items and they float based on the rules.

If you don't want to use this feature, don't set any floating routes and it is completely unintrusive.
Comment 10 Olli-Antti Kivilahti 2015-06-12 12:25:15 UTC
Thanks for pushing Bernardo.

I hope images are worth more than 100 words ;)
Comment 11 Olli-Antti Kivilahti 2015-06-29 11:05:43 UTC
In production for ~3 weeks. Working fine and helping a lot!
Comment 12 Mirko Tietgen 2015-07-03 08:22:46 UTC
Would test if it had a test plan.
Comment 13 Olli-Antti Kivilahti 2015-07-03 09:36:45 UTC
+-----------------------------+
| USAGE TIPS (sorry didn't document these in the GUI |
+-----------------------------+

When modifying a floating route rule, pressing "%" accepts the modification and pressing "V" cancels the modifications and reverts the old rule.
The empty text box in the center of the route rule (under the floating type dropdown list) is the box for conditional rules, where you put the logical expression.

+-----------------------------+
| SETTING UP THE TEST CONTEXT |
+-----------------------------+

-2. Set syspref "HomeOrHoldingBranchReturn" to homebranch.
-1. Find an Item, which can be circulated freely, and has homebranch B and
    any holdingbranch.
0. Read the instructions at admin/floating-matrix.pl.

+-----------+
| TEST PLAN: Disabled floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Disabled" and vice versa (B -> A).
1. Set your current library to A.
2. Check-in the Item.
3. Observe the started transport to branch B.
4. Set your current library to B.
5. Check-in to receive the transfer.

+-----------+
| TEST PLAN: Always floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Allowed".
1. Set your current library to A.
2. Check-in the Item.
3. Observe that there is not transport prompt to branch B and the Item is not
   "in-transit" -state.

+-----------+
| TEST PLAN: Possibly floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Possible".
1. Set your current library to A.
2. Check-in the Item.
3. Observe that there is a transport prompt to branch B. You can decide if you
   want to transfer or no.

+-----------+
| TEST PLAN: Conditional floating:
+-----------+

0. Same as Always floating if the given condition matches. See the feature description at admin/floating-matrix.pl explaining Conditional floating.
Comment 14 Olli-Antti Kivilahti 2015-11-11 13:12:47 UTC Comment hidden (obsolete)
Comment 15 Olli-Antti Kivilahti 2015-11-11 13:14:30 UTC
Created attachment 44756 [details] [review]
Bug 9525 - group floating rules, floating rule tester :)
Comment 16 Olli-Antti Kivilahti 2015-11-11 13:42:52 UTC
Created attachment 44760 [details] [review]
Bug 9525 - group floating rules, CGI doesn't understand DELETE at all.

instead of DELETE we GET the delete request so CGI works with it.
Comment 17 Nicole C. Engard 2016-01-25 20:43:22 UTC
40077 - Bug 9525 - group floating rules
44756 - Bug 9525 - group floating rules, floating rule tester :)
44760 - Bug 9525 - group floating rules, CGI doesn't understand DELETE at all.

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 9525 - group floating rules
fatal: sha1 information is lacking or useless (C4/Circulation.pm).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 9525 - group floating rules
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-9525---group-floating-rules-MxbdS8.patch
Comment 18 Olli-Antti Kivilahti 2016-02-08 13:58:31 UTC
Hi!

This feature work really well :) :) :)

We are going to rebase it this summer (hopefully)
Comment 19 Olli-Antti Kivilahti 2016-02-23 09:54:31 UTC
Created attachment 48310 [details] [review]
Bug 9525 - group floating rules - added logging ALWAYS and CODITIONAL floats.

SELECT * FROM action_logs WHERE module = "FLOATING";
Comment 20 Olli-Antti Kivilahti 2017-01-16 14:14:31 UTC
Latest code for this feature can be found from our GitHub:
https://github.com/KohaSuomi/kohasuomi

Look for commits starting with the tag "Bug 9525 - "

We are porting all our code to master presently and hopefully by Q1 2017 we have updated patches here in Bugzilla.

Looks like this needs to be rebased to the REST API as well.
Comment 21 Emmi Takkinen 2020-03-10 08:29:56 UTC
Created attachment 100420 [details] [review]
Bug 9525: Group floating rules

Rebased with latest version from https://github.com/KohaSuomi/kohasuomi. Patch combines all previously made patches for this feature.
 
To test follow test plan in comment 13.
Comment 22 Emmi Takkinen 2020-03-10 08:46:42 UTC
Created attachment 100421 [details] [review]
Bug 9525: Fixing floating on return
Comment 23 Emmi Takkinen 2020-03-10 08:49:13 UTC
Created attachment 100422 [details] [review]
Bug 9525: Add support for regexps in conditional floating clauses
Comment 24 Owen Leonard 2020-03-11 13:21:52 UTC
I got a couple of conflicts when applying these patches but was able to resolve them. However, I get an error when running the database update:

ERROR 1005 (HY000): Can't create table 'koha_kohadev.floating_matrix' (errno: 150)
Comment 25 Owen Leonard 2020-03-11 13:26:52 UTC
(In reply to Owen Leonard from comment #24)
> ERROR 1005 (HY000): Can't create table 'koha_kohadev.floating_matrix'
> (errno: 150)

Is this because I was supposed to apply the last three patches on top of the remote github branch? 

> Look for commits starting with the tag "Bug 9525 - "

Sorry I don't know what this means. I'm accustomed to seeing a separate testing branch.
Comment 26 Emmi Takkinen 2020-03-12 08:02:21 UTC
(In reply to Owen Leonard from comment #25)
> (In reply to Owen Leonard from comment #24)
> > ERROR 1005 (HY000): Can't create table 'koha_kohadev.floating_matrix'
> > (errno: 150)
Hm, it seems I missed that in kohastructure.pl there was: 
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

instead of:
ENGINE = InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

That's likely the issue here. I'll recheck patches for any other possible problems and reattach them later.    

> Is this because I was supposed to apply the last three patches on top of the
> remote github branch? 
> > Look for commits starting with the tag "Bug 9525 - "
> 
> Sorry I don't know what this means. I'm accustomed to seeing a separate
> testing branch.
No need to use remote branch or look commits related to this, all latest code is included here and should work after I fix this issue with database.  

>I got a couple of conflicts when applying these patches but was able to resolve them.
Anything I could look into?
Comment 27 Emmi Takkinen 2020-03-16 12:13:07 UTC
Created attachment 100741 [details] [review]
Bug 9525: Group floating rules

+-----------------------------+
| USAGE TIPS (sorry didn't document these in the GUI |
+-----------------------------+

When modifying a floating route rule, pressing "%" accepts the modification and pressing "V" cancels the modifications and reverts the old rule.
The empty text box in the center of the route rule (under the floating type dropdown list) is the box for conditional rules, where you put the logical expression.

+-----------------------------+
| SETTING UP THE TEST CONTEXT |
+-----------------------------+

-1. Find an Item, which can be circulated freely, and has homebranch B and
    any holdingbranch.
0. Read the instructions at admin/floating-matrix.pl.

+-----------+
| TEST PLAN: Disabled floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Disabled" and vice versa (B -> A).
1. Set your current library to A.
2. Check-in the Item.
3. Observe the started transport to branch B.
4. Set your current library to B.
5. Check-in to receive the transfer.

+-----------+
| TEST PLAN: Always floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Allowed".
1. Set your current library to A.
2. Check-in the Item.
3. Observe that there is not transport prompt to branch B and the Item is not
   "in-transit" -state.

+-----------+
| TEST PLAN: Possibly floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Possible".
1. Set your current library to A.
2. Check-in the Item.
3. Observe that there is a transport prompt to branch B. You can decide if you
   want to transfer or no.

+-----------+
| TEST PLAN: Conditional floating:
+-----------+

0. Same as Always floating if the given condition matches. See the feature description at admin/floating-matrix.pl explaining Conditional floating.

+-----------+
| TEST PLAN: Floating rule tester:
+-----------+

0. Add some floating rules between libraries
1. Choose origin library, destination library and give barcode for the item you want to test
2. Hit "Test"
3. Make sure box next to the "Test" button changes color according rules you made
4. Also for conditional floating use barcode for item that doesn't match given condition
Comment 28 Emmi Takkinen 2020-03-16 12:13:39 UTC
Created attachment 100742 [details] [review]
Bug 9525: Fixing floating on return
Comment 29 Emmi Takkinen 2020-03-16 12:14:21 UTC
Created attachment 100743 [details] [review]
Bug 9525: Add support for regexps in conditional floating
Comment 30 Laurence Rault 2020-04-23 10:58:40 UTC
On biblibre sandbox, impossible to apply the patch : 

Auto-merging Koha/Schema/Result/Branch.pm
CONFLICT (content): Merge conflict in Koha/Schema/Result/Branch.pm
Auto-merging C4/Circulation.pm
CONFLICT (content): Merge conflict in C4/Circulation.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 9525: Group floating rules
Comment 31 Emmi Takkinen 2020-04-28 07:54:19 UTC
Created attachment 103828 [details] [review]
Bug 9525: Group floating rules

Rebased patch and moved schema changes into a separate patch.
Comment 32 Emmi Takkinen 2020-04-28 07:54:50 UTC
Created attachment 103829 [details] [review]
Bug 9525: Schema changes - DO NOT PUSH
Comment 33 Emmi Takkinen 2020-04-28 07:55:18 UTC
Created attachment 103830 [details] [review]
Bug 9525: Fixing floating on return
Comment 34 Emmi Takkinen 2020-04-28 07:56:00 UTC
Created attachment 103831 [details] [review]
Bug 9525: Add support for regexps in conditional floating clauses
Comment 35 Lisette Scheer 2020-10-24 21:05:49 UTC
103828 - Bug 9525: Group floating rules
103829 - Bug 9525: Schema changes - DO NOT PUSH
103830 - Bug 9525: Fixing floating on return
103831 - Bug 9525: Add support for regexps in conditional floating clauses

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 9525: Group floating rules
Using index info to reconstruct a base tree...
M       C4/Circulation.pm
M       installer/data/mysql/kohastructure.sql
M       koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
Auto-merging installer/data/mysql/kohastructure.sql
Auto-merging C4/Circulation.pm
CONFLICT (content): Merge conflict in C4/Circulation.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 9525: Group floating rules
Comment 36 Emmi Takkinen 2020-10-27 10:58:18 UTC
Created attachment 112550 [details] [review]
Bug 9525: Group floating rules

+-----------------------------+
| USAGE TIPS (sorry didn't document these in the GUI |
+-----------------------------+

When modifying a floating route rule, pressing "%" accepts the modification and pressing "V" cancels the modifications and reverts the old rule.
The empty text box in the center of the route rule (under the floating type dropdown list) is the box for conditional rules, where you put the logical expression.

+-----------------------------+
| SETTING UP THE TEST CONTEXT |
+-----------------------------+

-1. Find an Item, which can be circulated freely, and has homebranch B and
    any holdingbranch.
0. Read the instructions at admin/floating-matrix.pl.

+-----------+
| TEST PLAN: Disabled floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Disabled" and vice versa (B -> A).
1. Set your current library to A.
2. Check-in the Item.
3. Observe the started transport to branch B.
4. Set your current library to B.
5. Check-in to receive the transfer.

+-----------+
| TEST PLAN: Always floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Allowed".
1. Set your current library to A.
2. Check-in the Item.
3. Observe that there is not transport prompt to branch B and the Item is not
   "in-transit" -state.

+-----------+
| TEST PLAN: Possibly floating:
+-----------+

0. Make sure that the floating rules from branch A to branch B (A -> B) are
   "Possible".
1. Set your current library to A.
2. Check-in the Item.
3. Observe that there is a transport prompt to branch B. You can decide if you
   want to transfer or no.

+-----------+
| TEST PLAN: Conditional floating:
+-----------+

0. Same as Always floating if the given condition matches. See the feature description at admin/floating-matrix.pl explaining Conditional floating.

+-----------+
| TEST PLAN: Floating rule tester:
+-----------+

0. Add some floating rules between libraries
1. Choose origin library, destination library and give barcode for the item you want to test
2. Hit "Test"
3. Make sure box next to the "Test" button changes color according rules you made
4. Also for conditional floating use barcode for item that doesn't match given condition
Comment 37 Emmi Takkinen 2020-10-27 10:58:55 UTC
Created attachment 112551 [details] [review]
Bug 9525: Schema changes - DO NOT PUSH
Comment 38 Emmi Takkinen 2020-10-27 10:59:25 UTC
Created attachment 112552 [details] [review]
Bug 9525: Fixing floating on return
Comment 39 Emmi Takkinen 2020-10-27 11:00:23 UTC
Created attachment 112553 [details] [review]
Bug 9525: Add support for regexps in conditional floating clauses

itype =~ ^(KI|DV) or location eq 'SHELF'
Comment 40 Emmi Takkinen 2020-10-27 11:00:43 UTC
Rebased patches.
Comment 41 Emmi Takkinen 2021-09-13 07:17:37 UTC
We are currently working on upcoming version update and have decided to ditch this floating matrix feature. Instead we've decided use float groups which work like hold groups introduced in bug 22284.
Comment 42 Emmi Takkinen 2021-09-13 07:18:53 UTC
Created attachment 124825 [details] [review]
Bug 9525: Add ft_local_float_group column

This patch adds new ft_local_float_group column
to library_groups table.

To test:
1. Apply patch and update database
2. Confirm new column is added correctly to the
library_groups table

Sponsored-by: Koha-Suomi Oy
Comment 43 Emmi Takkinen 2021-09-13 07:19:25 UTC
Created attachment 124826 [details] [review]
Bug 9525: DO NOT PUSH! Schema update

Sponsored-by: Koha-Suomi Oy
Comment 44 Emmi Takkinen 2021-09-13 07:20:00 UTC
Created attachment 124827 [details] [review]
Bug 9525: Add option to define float groups and rules for float

Bug 22284 introduced ability to create hold groups.
We should have ability to create float groups in
same manner. This patch adds checkbox "Is local
float group" to group creation feature and new return
policy "Item floats by librarygroup".

To test:
1. Add new float group and some libraries to it.
2. From circulation and fine rules, set default
return policy as "Item floats by library group".
3. Check out an item for a patron.
4. Set library as one that belongs in the same
float group.
5. Check in the item.
=> Observe that notice for transfer doesn't pop up.
6. Check out again.
7. This time set library as one that doen's
belong in the same float group.
8. Check in.
=> Observe that notice for transfer pops up.

Experiment this feature by changing return policy
per library, item type etc.

Also prove t/db_dependent/Koha/Libraries.t

Sponsored-by: Koha-Suomi Oy
Comment 45 Emmi Takkinen 2021-09-13 07:22:23 UTC
Attached new patches, removed dependencies on bug 13906 and bug 13995.