We should return the updated Koha::Account::Line object for the credit we are applying. This would allow subsequent chaining and allow for Koha::Object::Message sets to be embedded in the result and passed back to the caller.
Created attachment 118511 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place.
Created attachment 118512 [details] [review] Bug 27995: Update return for Koha::Account::Line->apply This patch updates the return value of Koha::Account::Line->apply to return the updated Koha::Account::Line object with Koha::Object::Messages embedded for the results of any triggered renewals. Available credit, the former return value, is still availabe via the object directly as `amountoutstanding`. Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect the change. No other area's of Koha relied upon the return value. This patch also fixes a bug whereby if you passed a list of debits with an outstanding debit larger than the outstanding credit then you could end up with superflous offest lines with zero amounts that was highlighted by the improved unit tests in t/db_dependent/Koha/Account/Line.t Test plan 1/ Run t/db_dependent/Koha/Account/Line.t 2/ Run t/db_dependent/api/v1/patrons_accounts.t 3/ If both tests pass then signoff
Created attachment 118615 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place.
Created attachment 118616 [details] [review] Bug 27995: Update return for Koha::Account::Line->apply This patch updates the return value of Koha::Account::Line->apply to return the updated Koha::Account::Line object with Koha::Object::Messages embedded for the results of any triggered renewals. Available credit, the former return value, is still availabe via the object directly as `amountoutstanding`. Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect the change. No other area's of Koha relied upon the return value. This patch also fixes a bug whereby if you passed a list of debits with an outstanding debit larger than the outstanding credit then you could end up with superflous offest lines with zero amounts that was highlighted by the improved unit tests in t/db_dependent/Koha/Account/Line.t Test plan 1/ Run t/db_dependent/Koha/Account/Line.t 2/ Run t/db_dependent/api/v1/patrons_accounts.t 3/ If both tests pass then signoff
Created attachment 119182 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 119183 [details] [review] Bug 27995: Update return for Koha::Account::Line->apply This patch updates the return value of Koha::Account::Line->apply to return the updated Koha::Account::Line object with Koha::Object::Messages embedded for the results of any triggered renewals. Available credit, the former return value, is still availabe via the object directly as `amountoutstanding`. Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect the change. No other area's of Koha relied upon the return value. This patch also fixes a bug whereby if you passed a list of debits with an outstanding debit larger than the outstanding credit then you could end up with superflous offest lines with zero amounts that was highlighted by the improved unit tests in t/db_dependent/Koha/Account/Line.t Test plan 1/ Run t/db_dependent/Koha/Account/Line.t 2/ Run t/db_dependent/api/v1/patrons_accounts.t 3/ If both tests pass then signoff Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Ok, I like the change. QA scripts are happy. I did a $ git grep '\>apply' just in case, so I ran: k$ prove t/db_dependent/Koha/Account/Line.t \ t/db_dependent/api/v1/patrons_accounts.t \ t/db_dependent/Circulation.t \ t/db_dependent/Koha/Account.t \ t/db_dependent/Koha/Items.t => SUCCESS: Tests pass!
Created attachment 119203 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 119204 [details] [review] Bug 27995: Update return for Koha::Account::Line->apply This patch updates the return value of Koha::Account::Line->apply to return the updated Koha::Account::Line object with Koha::Object::Messages embedded for the results of any triggered renewals. Available credit, the former return value, is still availabe via the object directly as `amountoutstanding`. Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect the change. No other area's of Koha relied upon the return value. This patch also fixes a bug whereby if you passed a list of debits with an outstanding debit larger than the outstanding credit then you could end up with superflous offest lines with zero amounts that was highlighted by the improved unit tests in t/db_dependent/Koha/Account/Line.t Test plan 1/ Run t/db_dependent/Koha/Account/Line.t 2/ Run t/db_dependent/api/v1/patrons_accounts.t 3/ If both tests pass then signoff Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Tree re-arranged slightly to put bugs that need backporting before these enhancements that don't. Rebased to accommodate the above.
(In reply to Martin Renvoize from comment #10) > Tree re-arranged slightly to put bugs that need backporting before these > enhancements that don't. > > Rebased to accommodate the above. +1
Created attachment 120010 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 120011 [details] [review] Bug 27995: Update return for Koha::Account::Line->apply This patch updates the return value of Koha::Account::Line->apply to return the updated Koha::Account::Line object with Koha::Object::Messages embedded for the results of any triggered renewals. Available credit, the former return value, is still availabe via the object directly as `amountoutstanding`. Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect the change. No other area's of Koha relied upon the return value. This patch also fixes a bug whereby if you passed a list of debits with an outstanding debit larger than the outstanding credit then you could end up with superflous offest lines with zero amounts that was highlighted by the improved unit tests in t/db_dependent/Koha/Account/Line.t Test plan 1/ Run t/db_dependent/Koha/Account/Line.t 2/ Run t/db_dependent/api/v1/patrons_accounts.t 3/ If both tests pass then signoff Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 120078 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 120079 [details] [review] Bug 27995: Update return for Koha::Account::Line->apply This patch updates the return value of Koha::Account::Line->apply to return the updated Koha::Account::Line object with Koha::Object::Messages embedded for the results of any triggered renewals. Available credit, the former return value, is still availabe via the object directly as `amountoutstanding`. Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect the change. No other area's of Koha relied upon the return value. This patch also fixes a bug whereby if you passed a list of debits with an outstanding debit larger than the outstanding credit then you could end up with superflous offest lines with zero amounts that was highlighted by the improved unit tests in t/db_dependent/Koha/Account/Line.t Test plan 1/ Run t/db_dependent/Koha/Account/Line.t 2/ Run t/db_dependent/api/v1/patrons_accounts.t 3/ If both tests pass then signoff Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 120080 [details] [review] Bug 27995: (QA follow-up) Update POD
Created attachment 120083 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 120085 [details] [review] Bug 27995: Unit tests This patch updates the unit tests for Koha::Account::Line->apply to reflect the change we wish to make to the return value. Instead of returning the scalar amount of available credit left on the credit line after calling apply, we want to return the full, updated, Koha::Account::Line object including Koha::Object::Messages for the result of renewals that may have taken place. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 120086 [details] [review] Bug 27995: Update return for Koha::Account::Line->apply This patch updates the return value of Koha::Account::Line->apply to return the updated Koha::Account::Line object with Koha::Object::Messages embedded for the results of any triggered renewals. Available credit, the former return value, is still availabe via the object directly as `amountoutstanding`. Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect the change. No other area's of Koha relied upon the return value. This patch also fixes a bug whereby if you passed a list of debits with an outstanding debit larger than the outstanding credit then you could end up with superflous offest lines with zero amounts that was highlighted by the improved unit tests in t/db_dependent/Koha/Account/Line.t Test plan 1/ Run t/db_dependent/Koha/Account/Line.t 2/ Run t/db_dependent/api/v1/patrons_accounts.t 3/ If both tests pass then signoff Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 120087 [details] [review] Bug 27995: (QA follow-up) Update POD Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Pushed to master for 21.05, thanks to everybody involved!
Enhancement not pushed to 20.11.x