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: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

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.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to