https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26540

Martin Renvoize (ashimema) <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Failed QA                   |Passed QA

--- Comment #25 from Martin Renvoize (ashimema) 
<[email protected]> ---
Hi all,

Thanks Pedro, good catch on the POS register page. I could reproduce it here:
with UseCashRegisters on and a register at the library,
pos/register.pl?registerid=1 fails with "The method Koha::Cash::Registers->size
is not covered by tests!" from includes/transaction_types.inc.

The cause is that the new check in the shared include reads the "registers"
variable from whichever page includes it. The patron account pages (boraccount,
mancredit, paycollect, pos/pay) get it from the Registers.all plugin, which
returns an array. pos/register.pl passes a Koha::Cash::Registers resultset
instead, which has no "size", so it blows up. register.tt never actually used
that "registers" param. It only uses the single "register" and the
error_registers flag, so it was a leftover from the original register details
page. The include is used there for the Issue refund modal.

I have attached a follow-up patch that:

- makes transaction_types.inc independent of the caller. It now asks the
Registers plugin itself whether the current library has any register before
hiding CASH for payout and refund. That keeps it as one include with the same
result on every page.
- removes the unused "registers" template parameter from pos/register.pl.

Testing done: pos/register.pl now loads and the refund modal still offers CASH.
On the patron account page, payout and refund still offer CASH when the library
has a register, and CASH is hidden when it has none.

Two notes for later:

- Passing an array in some templates and a resultset in others is what caused
this. It would be better to have the Registers plugin return a resultset too,
but that touches the plugin, the options_for_registers block and about seven
templates, so I'd rather do that on a separate bug.
- pos/register.pl does not scope the registerid parameter to the current
library. If someone opens a register from another library and their own library
has none, CASH would be hidden on that refund modal. It's an edge case and not
new in this patch, so I haven't changed it here.

Setting this back to Passed QA for Pedro's queue.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to