They should return lists in list context, and the iterator in scalar, as other methods like '->lines'.
Created attachment 82746 [details] [review] Bug 21909: Unit tests This patch introduces regression tests for the behaviour to be introduced. Both outstanding_credits and outstanding_debits methods should return a Koha::Account::Lines object in scalar context, and a list of Koha::Account::Line objects in list context. To test: - Apply this patch - Run $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: The current behaviour doesn't match the described
Created attachment 82747 [details] [review] Bug 21909: Make Koha::Account::outstanding_* preserve context This patch modifies the methods so they preserve the caller's context (list and scalar). To test: - Apply the first patch - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: outstanding_credits and outstanding_debits tests fail - Apply this patch - Run: k$ prove t/db_dependent/Koha/Account.t => SUCCESS: We are so happy now :-D - Sign off :-D
Created attachment 82748 [details] [review] Bug 21909: Add return type explanation to POD
Created attachment 82751 [details] [review] Bug 21909: Unit tests This patch introduces regression tests for the behaviour to be introduced. Both outstanding_credits and outstanding_debits methods should return a Koha::Account::Lines object in scalar context, and a list of Koha::Account::Line objects in list context. To test: - Apply this patch - Run $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: The current behaviour doesn't match the described Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 82752 [details] [review] Bug 21909: Make Koha::Account::outstanding_* preserve context This patch modifies the methods so they preserve the caller's context (list and scalar). To test: - Apply the first patch - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: outstanding_credits and outstanding_debits tests fail - Apply this patch - Run: k$ prove t/db_dependent/Koha/Account.t => SUCCESS: We are so happy now :-D - Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 82753 [details] [review] Bug 21909: Add return type explanation to POD Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nice catch, works as expected.. Signing Off.
Created attachment 82799 [details] [review] Bug 21909: Unit tests This patch introduces regression tests for the behaviour to be introduced. Both outstanding_credits and outstanding_debits methods should return a Koha::Account::Lines object in scalar context, and a list of Koha::Account::Line objects in list context. To test: - Apply this patch - Run $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: The current behaviour doesn't match the described Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 82800 [details] [review] Bug 21909: Make Koha::Account::outstanding_* preserve context This patch modifies the methods so they preserve the caller's context (list and scalar). To test: - Apply the first patch - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: outstanding_credits and outstanding_debits tests fail - Apply this patch - Run: k$ prove t/db_dependent/Koha/Account.t => SUCCESS: We are so happy now :-D - Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 82801 [details] [review] Bug 21909: Add return type explanation to POD Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Simple rebase needed
Created attachment 83511 [details] [review] Bug 21909: Unit tests This patch introduces regression tests for the behaviour to be introduced. Both outstanding_credits and outstanding_debits methods should return a Koha::Account::Lines object in scalar context, and a list of Koha::Account::Line objects in list context. To test: - Apply this patch - Run $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: The current behaviour doesn't match the described Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 83512 [details] [review] Bug 21909: Make Koha::Account::outstanding_* preserve context This patch modifies the methods so they preserve the caller's context (list and scalar). To test: - Apply the first patch - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => FAIL: outstanding_credits and outstanding_debits tests fail - Apply this patch - Run: k$ prove t/db_dependent/Koha/Account.t => SUCCESS: We are so happy now :-D - Sign off :-D Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 83513 [details] [review] Bug 21909: Add return type explanation to POD Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
(In reply to Nick Clemens from comment #11) > Simple rebase needed Tests count mismatch, done!
Awesome work all! Pushed to master for 19.05
I'm changing this from 'enhancement' to 'minor' as I believe it was a mistake and thus a bug in the first place for the caller context to be lost.. as such: Pushed to 18.11.x for 18.11.02.
cannot cleanly apply this for 18.05. if this is needed in 18.05 can we please rebase.
(In reply to Lucas Gass from comment #18) > cannot cleanly apply this for 18.05. if this is needed in 18.05 can we > please rebase. You can skip it, Lucas.