[Koha-bugs] [Bug 27032] CanBookBeRenewed is not understandable and needs refactoring

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Sep 29 12:15:26 CEST 2021


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

Jonathan Druart <jonathan.druart+koha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonathan.druart+koha at gmail.
                   |                            |com

--- Comment #15 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
Joonas, don't you think we should have the same return than CanBookBeRenewed?

  ($boolean, $reason);

The 'return "no";' seems weird to me.

We could then replace:

    $auto_renew = _CanBookBeAutoRenewed($borrowernumber, $itemnumber);
    return ( 0, $auto_renew  ) if $auto_renew =~ 'auto_account_expired';
    return ( 0, $auto_renew  ) if $auto_renew =~ 'auto_too_late';
    return ( 0, $auto_renew  ) if $auto_renew =~ 'auto_too_much_oweing';

with:

    my ( $can_be_auto_renewed, $reason ) =
_CanBookBeAutoRenewed($borrowernumber, $itemnumber);
    return ( 0, $reason ) unless $can_be_auto_renewed;

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list