Bug 7887

Summary: Add Option To Include Items That Will Be Available When Calculating Holds Ratios
Product: Koha Reporter: Kyle M Hall <kyle.m.hall>
Component: CirculationAssignee: Kyle M Hall <kyle.m.hall>
Status: RESOLVED DUPLICATE QA Contact: Ian Walls <koha.sekjal>
Severity: enhancement    
Priority: P5 - low CC: alex.arnaud, chris, gmcharlt, julian.maurice, kyle, veron
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15997
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 7887 - Add Option To Include Items That Will Be Available When Calculating Holds Ratios
Bug 7887 - Add Option To Include Items That Will Be Available When Calculating Holds Ratios
Bug 7887 - Followup - Make use of aqorders conditional. Use COALESCE to prevent NULL addition.
Bug 7887 - Add Option To Include Items That Will Be Available When Calculating Holds Ratios
Bug 7887 - Followup - Make use of aqorders conditional. Use COALESCE to prevent NULL addition.

Description Kyle M Hall 2012-04-03 13:26:30 UTC
Add the ability to count items that will be available in the future when calculating holds ratios.
[+] Comment 1 Kyle M Hall 2012-04-03 13:29:32 UTC Comment hidden (obsolete)
Comment 2 Alex Arnaud 2012-06-11 13:29:30 UTC
This patch doesn't apply using 3-way merge.

"CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/help/circ/reserveratios.tt
Failed to merge in the changes."
Comment 3 Alex Arnaud 2012-06-11 13:51:33 UTC
Kyle, i just realize that this conflict is not relevant. It should apply without errors.
Have you this problem when applying the patch ?
[+] Comment 4 Kyle M Hall (khall) 2012-07-20 14:43:21 UTC Comment hidden (obsolete)
Comment 5 Julian Maurice 2012-08-10 11:57:33 UTC
1. from patch:
+my $not_for_loan_comparison = ( $include_will_be_available ) ? "<=" : "=";
...
+notforloan $not_for_loan_comparison 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0

In which case notforloan will be lesser than 0?

2. As use of aqorders table is conditional, I think the join should be conditionnal too.

3. I get "Illegal division by zero at /home/julian/koha/versions/community-master/circ/reserveratios.pl line 155." when checking "Include on order items".
It seems that x+NULL = NULL with MySQL. I think it can be fixed with (2)

Failed QA for (3)
Comment 6 Kyle M Hall (khall) 2012-08-13 13:06:12 UTC
(In reply to comment #5)
> 1. from patch:
> +my $not_for_loan_comparison = ( $include_will_be_available ) ? "<=" : "=";
> ...
> +notforloan $not_for_loan_comparison 0 AND damaged = 0 AND itemlost = 0 AND
> wthdrawn = 0
> 
> In which case notforloan will be lesser than 0?

Yes, a notforloan value of less than 0 indicates an item will eventually be available.

> 2. As use of aqorders table is conditional, I think the join should be
> conditionnal too.
> 
> 3. I get "Illegal division by zero at
> /home/julian/koha/versions/community-master/circ/reserveratios.pl line 155."
> when checking "Include on order items".
> It seems that x+NULL = NULL with MySQL. I think it can be fixed with (2)
> 
> Failed QA for (3)

Will fix.
[+] Comment 7 Kyle M Hall (khall) 2012-08-13 13:09:10 UTC Comment hidden (obsolete)
Comment 8 Chris Cormack 2013-01-13 00:25:41 UTC
Small conflict, I think just textual
Comment 9 Kyle M Hall (khall) 2013-01-17 16:50:36 UTC
Created attachment 14678 [details] [review]
Bug 7887 - Add Option To Include Items That Will Be Available When Calculating Holds Ratios

This commit adds the ability to include items that are on order in the
aquisitions module, and items whose notforloan attribute is less than
1 ( i.e. will be available in the future ) when calculating holds ratios.
Comment 10 Kyle M Hall (khall) 2013-01-17 16:51:13 UTC
Created attachment 14679 [details] [review]
Bug 7887 - Followup - Make use of aqorders conditional. Use COALESCE to prevent NULL addition.

COALESCE is an ANSI-compliant SQL function, which returns the first
non-null value passed to it. I have verified it is available in both
MySQL and Postgres.
Comment 11 Owen Leonard 2013-03-19 01:06:16 UTC
Please add a test plan.
Comment 12 Marc Véron 2015-12-20 16:30:38 UTC
Still valid?
Comment 13 Kyle M Hall (khall) 2016-03-07 13:44:17 UTC
(In reply to Marc Véron from comment #12)
> Still valid?

Half valid. The ability to count on order items was added with another patch, but only if items are created at the time of ordering. I will close this bug out and open a new one to add just that additional functionality.

*** This bug has been marked as a duplicate of bug 13298 ***
Comment 14 Kyle M Hall (khall) 2016-03-07 14:03:56 UTC
Bug 15997 has been filed to replace the need for this bug patch.