[Koha-bugs] [Bug 29746] New: Add a handy Koha::Boolean class

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Dec 21 13:42:43 CET 2021


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

            Bug ID: 29746
           Summary: Add a handy Koha::Boolean class
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: tomascohen at gmail.com
        QA Contact: testopia at bugs.koha-community.org

The idea is to provide an OO class that can carry a boolean value, and also
useful messages for feedback.

An example usage:

sub safe_to_delete {
    my ( $self ) = @_;

    my $result = Koha::Boolean->new;

    my $can = 1;

    if ( condition_1 ) {
        $can = 0;
        $result->add_message({ message => 'has_debt' });
    }
    ...
    if ( condition_n ) {
        $can = 0;
        $result->add_message({ message => 'has_guarantees' });
    }

    return $result->set_value($can);
}

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


More information about the Koha-bugs mailing list